Mark Bomgardner wrote:

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 )



Look at the source of the page that this script generates. Your input tags look like this

<td><input name=Main Classroom type=checkbox value=Main Classroom></td><td>Main Classroom</td>

See the problem? The html attribute values have spaces in them. As far as your browser knows "Classroom" is supposed to be an attribute like type and value. Since it doesn't understand it it drops it.

Here is some code, notice the \" surrounding the ".$key."

<?php

$vars = array("Main Classroom" => "Main Classroom",
                        "Break Out Classroom" => "Break Out Classroom",
                        "Gym" => "Gym",
                        "Firearms Range" => "Firearms Range",
                        "EVOC Track" => "EVOC Track");
echo "<form method=post action=twocoltests.php>";
echo "<fieldset><legend>Equipment Needed</legend>";

foreach($vars as $key => $value){
echo "<div><input name=\"".$key."\" type=checkbox value=\"".$value."\"><label for=\"".$key."\">".$value."</label></div>";
}
echo "</fieldset>";
echo "</form>";
?>

I also redid your layout. You should be able to control the layout much better with some simple CSS. Shoot me an e-mail if you wnat help with the CSS

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to