Jump to content

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

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.