Try:

  echo "<td><input name=".urlencode($key)." type=checkbox
value=".urlencode($value)."></td><td>". $value."</td>";


On Wed, May 14, 2008 at 4:02 PM, Mark Bomgardner <[EMAIL PROTECTED]>
wrote:

> 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 )
>
>

Reply via email to