Correct handling _POST[] and implode. PHP5
| From: | bearsfoot | Date: | Fri, 09 Oct 2009 05:44:59 +0000 |
| Subject: | Correct handling _POST[] and implode. PHP5 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-298787@lists.php.net to get a copy of this message | ||
Hi all,
I have a form that has has an array of information. Mulitple checkboxes can
be selected.
Choose the colors:
<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
When processing the form..
echo $_POST['Colors'] . '<br />'; // outputs 'Array'
if ( isset($_POST['Colors']) ) {
$_POST['Colors'] = implode(', ', $_POST['Colors']); //Converts an
array
into a single string
}
echo "Colors you chose: {$_POST['Colors']}<br />";
I get the following error when using the implode function.
Warning: implode() [function.implode]: Bad arguments
What I doing wrong ?
Thanks in advance.
--
View this message in context: http://www.nabble.com/Correct-handling-_POST---and-implode.-PHP5-tp25815789p25815789.html
Sent from the PHP - General mailing list archive at Nabble.com.