I have searched quite a bit posts dealing with 'checkbox' and 'problem' but have not found someone who has had the problem i am having:
I have a form that sends to the browser a checkbox, i'm using checker[] as the name so that it will return an array to my script on submit.
I'm going nuts because when i do a foreach loop on the array and echo the values, only the last checked value is in the displayed.
Everything looks in order, can anyone help me retain my sanity? THANKS!!!
Here is the HTML from my browser....
<form name='autoform' method='post'><table width='500' border='0'><tr><td width='80'><fieldlabel>Date: </fieldlabel></td><td width=''><input type='text' name='date' size='12' maxlength='10' value='2004-11-08'>
</td> </tr></table><BR><input
type='checkbox'
name='checker[]'
value=''>Put clothes away<BR><input
type='checkbox'
name='checker[]'
value='61'>Read Newspaper<BR><input
type='checkbox'
name='checker[]'
value='31'>Drink Water<BR><input
type='checkbox'
name='checker[]'
value='57'>Make bed<BR><input
type='checkbox'
name='checker[]'
value='58'>Take Vitamins<BR><BR><input type='submit' name='save' value='Submit'></form>
here is my php code for on save
<php>
if ($_REQUEST['save'])
{
//$this_record->save("","");
echo $_REQUEST['checker'] ; // echos 'array';
foreach ($_REQUEST['checker'] as $x);
{
echo $x. "<BR>"; // If I select all, all I get '58'
}
echo "<h1>" . $pagetitle . " saved.</h1><BR><BR><BR>";
exit;
}</php>