Jump to content

Archived

This topic is now archived and is closed to further replies.

Gaia

$_POST and multiple selects

Recommended Posts

Hi,

I have a form that has a multiple select ( where you can choose more then one option ) and i can't seem to figure out how to retrieve all the selected options with $_POST.

When i changed to $_GET, it showed in the url &option=1&option=4&option=5, etc.

So, I know they are being passed as the same variable, but I'm wondering how to retrieve them all via $_POST.

Thanks.

Share this post


Link to post
Share on other sites
Guest askjames01
if (isset($_POST['B1'])){
$contents = "Guest name: " . $_POST['gname'] .
"\n\nState: " . $_POST['gstate'] .
"\n\nZip: " . $_POST['gzip'] .
"\n\nCountry: " . $_POST['gcountry'] .
"\n\nE-mail: " . $_POST['gemail'];
}

i think this will give you an idea.

Share this post


Link to post
Share on other sites
What...

No, I know how to get the value of a single input...but I dont know how with a multiple select....

Thanks.

Share this post


Link to post
Share on other sites
You need to make the name of your select an array, then the multiple selections will be in the array:
[code]
<select name='test[]'>
[/code]

Ken

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.