Jump to content

Help with Select Options


arcanemachinist

Recommended Posts

I have a very interesting question, and I've been searching for the answer for quite a while. I've been avoiding message boards simply cause I hate the signup/login crap you have to go through. Bit the bullet this time...

 

Anywho...

 

I was wondering if it's possible while using <optgroup><option></option></optgroup> type selection boxes, for PHP to detect which optgroup the submitted option came from? If not, I have an alternate slightly messy method that I would like to try to avoid using.

 

This is what I would like for it to be (using optgroup identification):

<select name="server">
<optgroup label="United States">
  <option value="a">Server A</option>
  <option value="b">Server B</option>
</optgroup>
<optgroup label="Oceanic">
  <option value="a">Server A</option>
  <option value="b">Server B</option>
</optgroup>
</select>

 

However if its not possible this is what I have in mind (slightly messy version):

<select name="server">
<optgroup label="United States">
  <option value="us_a">Server A</option>
  <option value="us_b">Server B</option>
</optgroup>
<optgroup label="Oceanic">
  <option value="oc_a">Server A</option>
  <option value="oc_b">Server B</option>
</optgroup>
</select>

I would then explode the value that is submitted using the "_" as a delimiter. I would like to avoid this if possible though...

 

Any help would be greatly appreciated!

Link to comment
https://forums.phpfreaks.com/topic/49330-help-with-select-options/
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.