|
Posted by "zedleon" on 08/13/05 07:09
I am having an issue with building dynamic checkboxes.. They appeared to be
working properly...but then all the checkboxes in the array are "checking"
ater the initial checkbox is selected.
I am building a sticky form to present the data. so anything checked in the
HTML would be dynamically checked in the PHP.
I am grateful to Jochem Maas for getting me to this point...
Any help is appreciated...
Here is the HTML...
<html>
<head>
<title>Dynamic Checkboxes</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form method="post" action="checkboxcalc.php">
<p><input name="gmev[]" type="checkbox" id="gmev" value="September
9th">September 9th</p>
<p><input name="gmev[]" type="checkbox" id="gmev" value="October
14th">October 14th</p>
<p><input name="gmev[]" type="checkbox" id="gmev" value="November
11th">November 11th</p
<p><input name="gmev[]" type="checkbox" id="gmev" value="December
9th">December 9th</p>
<input type="submit" name="Submit" value="Submit Registration">
</form>
</body>
</html>
Here is the PHP
<?
if ($gmev) {
$checked = ' checked="checked"';
} else {
$checked = '';
}
echo '<input name="gmev[]" type="checkbox" id="gmev"',$checked,'/>September
9th';
if ($gmev) {
$checked = ' checked="checked"';
} else {
$checked = '';
}
echo '<input name="gmev[]" type="checkbox" id="gmev"',$checked,'/>October
14th';
if ($gmev) {
$checked = ' checked="checked"';
} else {
$checked = '';
}
echo '<input name="gmev[]" type="checkbox" id="gmev"',$checked,'/>November
11th';
if ($gmev) {
$checked = ' checked="checked"';
} else {
$checked = '';
}
echo '<input name="gmev[]" type="checkbox" id="gmev"',$checked,'/>December
9th';
?>
thanks
zedleon
Navigation:
[Reply to this message]
|