Loading...
Обучение/Помощь новичкам | не работает checked
Всем привет. такая не большая проблема
при выборе пункта нажимаешь кнопку сохранить ничего не меняется также если убрать галочку тоже не изменяется запрос
plaintext

if (isset($urlType[3]) AND $urlType[3] == 'game'){
if (isset($_POST['save'])) {	
	$game_platforms_1  	= ($_POST['game_platforms_1'] == 1 ? 1 : 0);
	$game_platforms_2  	= ($_POST['game_platforms_2'] == 1 ? 1 : 0);
	$game_platforms_3  	= ($_POST['game_platforms_3'] == 1 ? 1 : 0);
	$game_platforms_4  	= ($_POST['game_platforms_4'] == 1 ? 1 : 0);
	$game_platforms_5  	= ($_POST['game_platforms_5'] == 1 ? 1 : 0);
	$game_platforms_6  	= ($_POST['game_platforms_6'] == 1 ? 1 : 0);
	$game_platforms_7  	= ($_POST['game_platforms_7'] == 1 ? 1 : 0);
	$game_platforms_8  	= ($_POST['game_platforms_8'] == 1 ? 1 : 0);
	$game_platforms_9  	= ($_POST['game_platforms_9'] == 1 ? 1 : 0);
	$game_platforms_10  = ($_POST['game_platforms_10'] == 1 ? 1 : 0);
	$game_platforms_11  = ($_POST['game_platforms_11'] == 1 ? 1 : 0);
	$game_platforms 	= ",{$game_platforms_1},{$game_platforms_2},{$game_platforms_3},{$game_platforms_4},{$game_platforms_5},{$game_platforms_6},{$game_platforms_7},{$game_platforms_8},{$game_platforms_9},{$game_platforms_10},{$game_platforms_11}";
	if (!isset($err)) {
		$sql->query("UPDATE `users` SET 
		`game_platforms` = '{$game_platforms}'
		WHERE `id` = '{$us['id']}';");
		loc('?','Успешно');
	}
}
$data_pl = explode(",", $us['game_platforms']);
?>
<div class='div'>
<div class="post_2">
	<form method='post' action=''>
	<label>Android <input type='checkbox'<?=($data_pl[1] == 1 ?" checked='checked'": null)?> name='game_platforms_1' value='1' /></label><br />
	<label>Apple OS X <input type='checkbox'<?=($data_pl[2] == 1 ?" checked='checked'": null)?> name='game_platforms_2' value='1' /></label><br />
	<label>iOS <input type='checkbox'<?=($data_pl[3] == 1 ?" checked='checked'": null)?> name='game_platforms_3' value='1' /></label><br />
	<label>Linux <input type='checkbox'<?=($data_pl[4] == 1 ?" checked='checked'": null)?> name='game_platforms_4' value='1' /></label><br />
	<label>PlayStation 3 <input type='checkbox'<?=($data_pl[5] == 1 ?" checked='checked'": null)?> name='game_platforms_5' value='1' /></label><br />
	<label>PlayStation 4 <input type='checkbox'<?=($data_pl[6] == 1 ?" checked='checked'": null)?> name='game_platforms_6' value='1' /></label><br />
	<label>PS Vita <input type='checkbox'<?=($data_pl[7] == 1 ?" checked='checked'": null)?> name='game_platforms_7' value='1' /></label><br />
	<label>Windows <input type='checkbox'<?=($data_pl[8] == 1 ?" checked='checked'": null)?> name='game_platforms_8' value='1' /></label><br />
	<label>Xbox 360 <input type='checkbox'<?=($data_pl[9] == 1 ?" checked='checked'": null)?> name='game_platforms_9' value='1' /></label><br />
	<label>Xbox One <input type='checkbox'<?=($data_pl[10] == 1 ?" checked='checked'": null)?> name='game_platforms_10' value='1' /></label><br />
	<label>Консоль Nintendo <input type='checkbox'<?=($data_pl[11] == 1 ?" checked='checked'": null)?> name='game_platforms_11' value='1' /></label><br />
	</div>
	<br/>
	<?
	$num = $sql->num("SELECT * FROM `game_user` where `id_user` = '{$us['id']}' ");
	?>
	<div class="post_2">Ваши игры (<?=$num?>):</div>
	<?
	$i = 0;
	$query = $sql->query("SELECT * FROM `game_user` where `id_user` = '{$us['id']}' ORDER BY `date_create` DESC LIMIT 30");
	while ($game = $sql->obj_assoc($query))
	{
		$i++;
		$data_pl = explode(",", $us['game_platforms']);

		?>
		<div class="post_1">
		<?=output($game['name'])?> -
		<?
		if ($game['platforms'] == 1) {?>Android; <?}
		if ($game['platforms'] == 2) {?>Apple OS X; <?}
		if ($game['platforms'] == 3) {?>iOS; <?}
		if ($game['platforms'] == 4) {?>Linux; <?}
		if ($game['platforms'] == 5) {?>PlayStation 3; <?}	
		if ($game['platforms'] == 6) {?>PlayStation 4; <?}	
		if ($game['platforms'] == 7) {?>PS Vita;<?}	
		if ($game['platforms'] == 8) {?>Windows; <?}	
		if ($game['platforms'] == 9) {?>Xbox 360; <?}	
		if ($game['platforms'] == 10) {?>Xbox One; <?}	
		if ($game['platforms'] == 11) {?>Консоль Nintendo; <?}	
		?>[<a style="color:#d04e30;" href="/user/settings/<?=$us['link']?>/game/?del=<?=$game['id']?>">DEL</a>]
		</div>
		<?
	}
	?>
	<br/>
		<input type='submit' name='save' value='Сохранить' />
	</form>
</div>
может есть у кого идеи как код сократить и чтоб работал
Онлайн: 2
Время:
Gen. 0.0671
(c) Bym.Guru 2010-2026