Two word array Value
| From: | Mark Bomgardner | Date: | Wed, 14 May 2008 20:02:18 +0000 |
| Subject: | Two word array Value | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-274325@lists.php.net to get a copy of this message | ||
I am trying to use array's to populate a group of check boxes for a form. I
am getting the checkboxes to print OK, but when the form is posted I am only
getting part of the array.
Form Page:
$vars = array("Main Classroom" => "Main Classroom", "Break Out
Classroom" =>
"Break Out Classroom", "Gym" => "Gym",
"Firearms Range" => "Firearms Range", "EVOC Track" => "EVOC
Track");
$cols = 4;
echo "<form method=post action=twocoltests.php><table><tr><td
colspan=".$cols." align=center>Equipment Needed</td><tr>";
foreach($vars as $key => $value){
if (($cols % 4) == 0 ){ echo "</tr><tr>"; }
echo "<td><input name=".$key." type=checkbox
value=".$value."></td><td>".$value."</td>";
$cols++;
}
echo "</tr></table>";
echo "<br />";
When I submit the form I am only getting the following having checked the
boxes for Mail Classroom and Break Out Classroom. If I eliminate the spaces
between the words, I get everything, but when I put the spaces between the
words in the array, it cuts off the second word. Not sure what is
happening?
Array ( [Main] => Main [Break] => Break [Submit] => Submit )