I am trying to target the option label instead of its value in a PHP page.
I know that PHP is server side and it could be difficult to target the option label but is there a work around for this?
the code i am using is this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href=
"css/mainstyle_css.css" />
<meta http-equiv="Content-Type" content=
"text/html; charset=utf-8" />
<title>
title
</title>
</head>
<body>
<form method="post" action="">
<select name="myList" id="myList" class="myList">
<optgroup label="list 1">
<option value="music/one" label="techno">techno</option>
<option value="music/two" label="rock">rock</option>
</optgroup>
</select>
<input type="submit" name="submit" id="submit" class="submit" value="Search"/>
</form>
<?php echo $myList; ?>
</body>
</html>
with the code above I get the music/one and music/two echo-ed on the php page. what i need to do is to echo their labels which are "techno" and "rock".
could someone please help me out with this?