[SOLVED] How to get an option selected?
Posted: Mon Sep 27, 2004 10:18 am
Below is a drop down list I have in my form.
The problem I have is that when a user select an option from the drop down list and the page refresh, the drop down option list that the user chose did not get selected after the page is refresh. How do I get the option selected to be selected and shown on the drop down list after the page refresh?
ljCharlie
Code: Select all
<form name="frmScholarship" method="post" action="<?php $HTTP_SERVER_VARS['PHP_SELF']?>">
<select name="sltScholarship" id="sltScholarship" onChange="frmScholarship.submit()">
<?php
do {
?>
<option value="<?php echo $row_rsScholarshipType['sectionID']?>"<?php if (!(strcmp($row_rsScholarshipType['sectionID'], 100))) {echo "SELECTED";} ?>><?php echo $row_rsScholarshipType['category']?></option>
<?php
} while ($row_rsScholarshipType = mysql_fetch_assoc($rsScholarshipType));
$rows = mysql_num_rows($rsScholarshipType);
if($rows > 0) {
mysql_data_seek($rsScholarshipType, 0);
$row_rsScholarshipType = mysql_fetch_assoc($rsScholarshipType);
}
?>
</select>
</form>ljCharlie