I want to make the select box as selected value from the GET variable. Here is my code:
<select name="suraNo" id="suraNo" required="required">
<option value="">-Select-</option>
<?php
do {
?>
<option value="<?php echo $row_SuraList['suraNo']?>">
<?php echo $row_SuraList['suraNo']?>. <?php echo $row_SuraList['suraNameBN']?>
</option>
<?php
} while ($row_SuraList = mysql_fetch_assoc($SuraList));
$rows = mysql_num_rows($SuraList);
if($rows > 0) {
mysql_data_seek($SuraList, 0);
$row_SuraList = mysql_fetch_assoc($SuraList);
}
?>
</select>
If what you want is to select a value from your list that correspond to your GET param, simply use this:
Also, I suggest you to not close your php balise in your do...while and write your "options" like that: