Jump to content

[SOLVED] A list/menu menu is not carrying all values selected


JPark

Recommended Posts

This should be easy but it's driving me CRAZY!  All I want is two list/menus where the customer can select one or more options (using Cntl).

 

For some reason, I cannot get all of the values to be sent to the entry page.  If I select 3 states, I only get the last one.  (If I use checkboxes though, I can get all the values; of course, I don't want checkboxes...  grrr).

 

Here is a tiny bit of my code:

<select name="states" size="10" multiple="yes">
<option value="Alabama" name="states[]">Alabama</option>
<option value="Alaska" name="states[]">Alaska</option>
<option value="Arizona" name="states[]">Arizona</option>
<option value="Arkansas" name="states[]">Arkansas</option>
<option value="California" name="states[]">California</option>
</select>

 

And then on the entry page, I have tried print_r ($_POST['states']); or echo $_POST['states'];, expecting to see "array".  All I get is the last value.

 

What am I missing??

 

Thanks!

 

Joe

Link to comment
Share on other sites

<select name="states[]" size="10" multiple="yes">
<option value="Alabama" name="state1">Alabama</option>
<option value="Alaska" name="state2">Alaska</option>
<option value="Arizona" name="state3">Arizona</option>
<option value="Arkansas" name="state4">Arkansas</option>
<option value="California" name="state5">California</option>
</select>[code]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.