#34594 [Opn->Fbk]: Arrays from form get send over as string instead of array

From: Date: Thu, 22 Sep 2005 09:11:04 +0000
Subject: #34594 [Opn->Fbk]: 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-85422@lists.php.net to get a copy of this message
ID: 34594 Updated by: tony2001@php.net Reported By: thijs at toltech dot nl -Status: Open +Status: Feedback Bug Type: Variables related Operating System: Gentoo Linux PHP Version: 5.0.5 New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#85422) next »