| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
  [2005-09-22 11:01 UTC] thijs at toltech dot nl
 Description:
------------
By using form you can send Arrays over to the next page with the name="var_name[]" method.
However, doing this will result in that the $_POST['var_name'] will contain the string 'Array' all the time, no matter what is really send in.
(Note: this also happend to me in php5.1.0-b3, gentoo forced me to downgrade but I think it is also in php5.1.0-rc1, would be glad if anyone can check this for me)
Reproduce code:
---------------
<select name="color[]">
<option value="*">All</option>
<option value="red">Red</option>
<option value="blue">Blue</option>
<option value="green">Green</option>
<option value="orange">Orange</option>
<option value="yellow">Yellow</option>
</select>
and on the next page in php code:
<?php
print_r($_POST);
?>
Expected result:
----------------
The expected result is (assuming you selected 'Green' and 'Red':
Array 
(
    [color] = Array 
    (
        [0] = red
        [1] = green
    )
)
Actual result:
--------------
while will produce (no matter what you select):
Array 
(
    [color] = Array
)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             | 
    |||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 02:00:01 2025 UTC | 
Ok I found the problem, Every variable that is send over (GET and POST) variables is being checked: foreach($_POST as $key => $value) $_POST[$key] = addslashes(trim($value)); This somehow caused it to be a string with the value 'Array'. I searched around for help and found one similair bug on this site that was exactly the same.. so I thought it was a php bug. Sorry for this invalid bug post.. I closed it now