Correct handling _POST[] and implode. PHP5

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux