RE: [PHP] Correct handling _POST[] and implode. PHP5
| From: | Andrea Giammarchi | Date: | Fri, 09 Oct 2009 08:17:51 +0000 |
| Subject: | RE: [PHP] Correct handling _POST[] and implode. PHP5 | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-298795@lists.php.net to get a copy of this message | ||
> so it's simple, it's not an array, but your assignment magically makes it an array
> since you wrote "iterate over the array" ... very, very clear, isn't it?
OK, sarcasm a part, this works perfectly for me, and it's quite obvious Colors IS an array ...
<?php
if(isset($_POST['Colors']))
echo implode(',', $_POST['Colors'])
;
?>
<form method="POST" action="?">
<input type="checkbox" name="Colors[]" value="green"
checked="checked" /> Green
<input type="checkbox" name="Colors[]" value="yellow" />
Yellow
<input type="checkbox" name="Colors[]" value="red" /> Red
<input type="checkbox" name="Colors[]" value="gray" /> Gray
<input type="submit" />
</form>
Regards
_________________________________________________________________
Windows Live: Friends get your Flickr, Yelp, and Digg updates when they e-mail you.
http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_3:092010