> Date: Fri, 9 Oct 2009 02:07:55 -0700
> From: adam.p.reyno...@gmail.com
> To: php-general@lists.php.net
> Subject: RE: [PHP] Correct handling _POST[] and implode. PHP5
>
>
> I just realised I have get_magic_quotes_gpc turned on and was not catering
> for arrays.
>
I just realised I have get_magic_quotes_gpc turned on and was not catering
for arrays.
Thanks for your time.
Adam
Andrea Giammarchi-3 wrote:
>
>
>
>> 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
Hi Andrea,
Thanks for your responses.
The output from echo '', var_dump($_POST['Colors']), '';
is --> string(5) "Array"
I am using php version 5.2.10.
It is strange that you posted the same array and ran the implode function ok
? That has me baffled. I am several forms within the applicat
> 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 ...
Green
Yellow
Red
> Its very obvious that $_POST["color"] is not an array.
>
> do something like this and you wil get the values.
>
> $arr_color = $_POST["colors"];
>
> //iterate over the array
> foreach($arr_color as $val)
> {
> $str_color .= ", " . $val;
> }
so it's simple, it's not an array, but your a
>
> echo $_POST['Colors'] . ''; // outputs 'Array'
try with
echo '', var_dump($_POST['Colors']), '';
to be sure abot the structure. Also, which PHP version?
Regards
_
Keep your friends
Its Simple...
Its very obvious that $_POST["color"] is not an array.
do something like this and you wil get the values.
$arr_color = $_POST["colors"];
//iterate over the array
foreach($arr_color as $val)
{
$str_color .= ", " . $val;
}
You are done.
Gaurav Kumar
Teach Lead Open Source Tec
Hi all,
I have a form that has has an array of information. Mulitple checkboxes can
be selected.
Choose the colors:
Green
Yellow
Red
Gray
When processing the form..
echo $_POST['Colors'] . ''; // outputs 'Array'
if ( isset($_POST['Colors']) ) {
$_POST['Colors'] = implode(', ', $_PO
8 matches
Mail list logo