arcanemachinist Posted April 30, 2007 Share Posted April 30, 2007 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 More sharing options...
Lumio Posted April 30, 2007 Share Posted April 30, 2007 I think there is no other way and you have to do it like the second one. Link to comment https://forums.phpfreaks.com/topic/49330-help-with-select-options/#findComment-241729 Share on other sites More sharing options...
The Little Guy Posted April 30, 2007 Share Posted April 30, 2007 I think your second way would be better, since its not a good idea to have options with the same value that do different things. Link to comment https://forums.phpfreaks.com/topic/49330-help-with-select-options/#findComment-241733 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.