Page 1 of 1

Optgroup and PHP

Posted: Fri Dec 07, 2007 4:26 am
by iknownothing
Hey Guys,

Is there any way an OPTGROUP value can be POSTED just like the OPTION value?

Posted: Fri Dec 07, 2007 6:05 am
by vigge89
Use an option-element instead and just style it differentely?

Posted: Fri Dec 07, 2007 7:11 am
by iknownothing
sounds good in theory, but the OPTGROUP is one variable, and is needed, along with whatever child of it is selected.

eg.

Fruit
Apple
Orange
Vegetable
Lettuce
Peas

variables equally Fruit and Orange need to be used to maintain filesystem integrity. Not the best example, as a fruit can't be a vegetable, but in the real version, childs of two separate parents can have the same name.

Posted: Fri Dec 07, 2007 11:24 am
by feyd
Make their values unique (by including the parent, and their parent if need be.)

Posted: Fri Dec 07, 2007 6:27 pm
by iknownothing
you mean this, or something similar?

Code: Select all

<option value="<?php echo $parent; ?>-<?php echo $child; ?>">Child Name</option>
Then exploding the 2... If thats what you meant than, awesome, if not, at least it will work!