Re: Is there a way to get multiple values for a single input in a form submission?

From: Date: Wed, 22 Mar 2006 00:01:09 +0000
Subject: Re: Is there a way to get multiple values for a single input in a form submission?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-232376@lists.php.net to get a copy of this message
this is what I am trying to do: On a web form I might have a select input with multiple selections enabled, however I want to have access to the list within PHP after submission. <select multiple='true' name='myselect'> <option value='1'>1</option> <option value='2'>2</option> </select> so when this is submitted, I can see in the $HTTP_RAW_POST_DATA that myselect is submitted twice... ...&myselect=1&myselect=2&... However, the $_POST array only has the last value eg. $_POST['myselect'] == '2' This makes sense because the last value is assigned to the key 'myselect'. Is there a function or alternate way that will get an array back from the post-back without parsing through the $HTTP_RAW_POST_DATA (which is not always available since the php.ini file can turn it off)? TIA -MS
MS: You're not asking for an array, but simply a return of what value 'myselect' is. If your url is sending "&myselect=1&myselect=2&...", then something else is wrong. The following -- $what = $_POST('myselect'); echo($what); -- should show you what's there. Also, try print_r($_POST); I have a very simple exampleof POST/GET at: http://www.weberdev.com/get_example-4345.html tedd -- -------------------------------------------------------------------------------- http://sperling.com

« previous php.general (#232376) next »