[RESOLVED] remember check box selections...
PHP Code:
<form method="post">
<input type="checkbox" name="size[]" value="m">
<input type="checkbox" name="size[]" value="l">
<input type="checkbox" name="size[]" value="xl">
<input type="submit" name="go" value"Submit This"> <strong>Tomato Margherita - </strong> fresh tomato, olive oil, fresh basil, oregano and mozzarella<br>
<?if ($go and $HTTP_POST_VARS['size']){
//$size = $HTTP_POST_VARS['size'];
//echo $size[1];
foreach ($size as $f) {
echo $f."<br />";
}
} ?>
when this is submitted it displays the correct info, but does not maintain the checked boxes...
here is the site
http://www.questfor3d.com/phptest/FoodOrder.php
Re: remember check box selections...
Re: [RESOLVED] remember check box selections...
PHP Code:
<form method="POST">
<? if ($_POST['size1']) {?>
<input type="checkbox" name="size1" value="m" checked>
<?} else { ?>
<input type="checkbox" name="size1" value="m">
<?}?>
<? if ($_POST['size2']) {?>
<input type="checkbox" name="size2" value="l" checked>
<?} else { ?>
<input type="checkbox" name="size2" value="l">
<?}?>
<? if ($_POST['size3']) {?>
<input type="checkbox" name="size3" value="xl" checked>
<?} else { ?>
<input type="checkbox" name="size3" value="xl">
<?}?>
Re: [RESOLVED] remember check box selections...
<input type="checkbox" name="size1" value="m"<?=$_POST['size1'] ? ' checked="checked"' : ''>