Re: Two word array Value
| From: | Jason Murray | Date: | Wed, 14 May 2008 20:11:58 +0000 |
| Subject: | Re: Two word array Value | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-274326@lists.php.net to get a copy of this message | ||
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 <mbomgardner@kletc.org>
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 )
>
>