Jump to content

Using PHP to get HTML multiple selects


tmyonline

Recommended Posts

Hi guys,

 

This question is probably easy for most of you!  I have a PHP related question since I'm using it.

 

I have a html form like this:

 

<select name="fqdn" multiple="multiple">

  <option value="A">A</option>

  <option value="B">B</option>

  <option value="C">C</option>

  <option value="D">D</option>

  <option value="E">E</option>

  ...

</select>

 

This form will allow multiple selections.  Now, if it were a single selection, then I could say

 

if (isset($_POST['fqdn'])) {

  echo 'fqdn selected is: ' . $_POST['fqdn'];

}

 

to find out which option has been selected.  But now, suppose my users select options B, C, and E and clicks the submit button, how do I find out which options have been selected ?  The problem here is that each <option> tag does not have its own "name" attribute, so it's like there is one name that has multiple values.  I appreciate your help.  Thanks.

 

 

 

 

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/148611-using-php-to-get-html-multiple-selects/
Share on other sites

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.