Hello everybody.

I am scripting a combo box in php in which i want to store the selected option in variable. I am able to populate the list in combo box but i am not able to store the selected option in a variable.

One more thing, if i want to display the other combo box options on the basis of the selection of the first combo box then how to do that ?

Help will be deeply appreciated

MY CODE:-

//php part above body tab
<?php
mysql_select_db($database);
$query="SELECT subname FROM subject";
$result = mysql_query ($query);

if(isset($_POST['submit'])){
$selected = $_POST['select'];
if($selected=='1'){
echo "BCA";
}
if($selected=='2'){
echo "BScI.T";
}
}
?>

//start of body tag
<body>
<form name="form1" method="post" action="ques_insert.php">
<select name="select">
<option value="0">Select Subject</option>
<?php
while($record = mysql_fetch_array($result)){
$sid = $record["subid"];
$sname = $record["subname"];?>
<option value="<? $sid;?>"><? print($sname); ?></option><?
}
?>
</select>
<input type="submit" name="submit" value="Submit" />
</form>
</body>