We help IT Professionals succeed at work.

problem posting select option to a script

markmchugh
markmchugh asked
on
Hi,
I am using the following on a form

<select tabindex="6" multiple="multiple" size="4" name="area">
          <option value="11">Nationwide</option>
          <option value="12">United Kingdom</option>
          <option value="13">International</option>
        </select>

but when select multiple options only the last selected option is posted?
Comment
Watch Question

CERTIFIED EXPERT
Expert of the Year 2008
Top Expert 2008
Commented:
Add brackets to the name of the select:
<select tabindex="6" multiple="multiple" size="4" name="area[]">
          <option value="11">Nationwide</option>
          <option value="12">United Kingdom</option>
          <option value="13">International</option>
        </select>

On the server you retrieve it as:
$selectionArray = $_REQUEST['area'];

foreach( $selectionArray as $key => $val)
{
 echo($key . " == " . $val);
}

Explore More ContentExplore courses, solutions, and other research materials related to this topic.