lessieverchpmq
New Member
I have in my php\[code\]$sel = " <option> one </option> <option> two </option> <option> thre </option> <option> four </option>";\[/code\]let say I have an inline URL = \[code\]site.php?sel=one\[/code\]if I didn't saved those options in a variable, I can do it this way to make one of the option be SELECTED where value is equal to \[code\]$_GET[sel]\[/code\]\[code\]<option <?php if($_GET[sel] == 'one') echo"selected"; ?> > one </option><option <?php if($_GET[sel] == 'two') echo"selected"; ?> > two </option><option <?php if($_GET[sel] == 'three') echo"selected"; ?> > three </option><option <?php if($_GET[sel] == 'four') echo"selected"; ?> > four </option>\[/code\]but the problem is, I need to save those options in a variable because I have a lot of options and I need to call that variable many times.Is there a way to make that option be selected where \[code\]value = http://stackoverflow.com/questions/12782373/$_GET[sel]\[/code\] ?