#34594 [Fbk->Opn]: Arrays from form get send over as string instead of array
| From: | thijs at toltech dot nl | Date: | Thu, 22 Sep 2005 10:27:25 +0000 |
| Subject: | #34594 [Fbk->Opn]: Arrays from form get send over as string instead of array | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-85426@lists.php.net to get a copy of this message | ||
ID: 34594
User updated by: thijs at toltech dot nl
Reported By: thijs at toltech dot nl
-Status: Feedback
+Status: Open
Bug Type: Variables related
Operating System: Gentoo Linux
PHP Version: 5.0.5
New Comment:
I'm unable to post feedback on this matter due to that make install
fails on the location of the apache conf file.
(Which is httpd.conf instead of apache2.conf, I configured php with the
configuration taken from phpinfo() from my current php installation)
Previous Comments:
------------------------------------------------------------------------
[2005-09-22 11:11:03] tony2001@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.0-win32-latest.zip
Works perfectly here.
------------------------------------------------------------------------
[2005-09-22 11:01:52] 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
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34594&edit=1