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

<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]

Archived

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

×
×
  • 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.