<form name="add" method="post">
<p>Age:</p>
<select name="age">
<option value="1_sre">23</option>
<option value="2_sam">24</option>
<option value="5_john">25</option>
</select>
<input type="submit" name="submit"/>
</form>
You will have the selected value in $_POST['age']
, e.g. 1_sre
. Then you will be able to split the value and get the 'stud_name'
.
$stud = explode("_",$_POST['age']);
$stud_id = $stud[0];
$stud_name = $stud[1];