Hi all,
When the below menu is selected from it is processed by PHP code(PART II)
I want the selected option to then be displayed automatically.
However, the bottom option is automatically displayed.
How do I fix this?? Thanks.
<p>
<label for="name" class="personal">Fund Name</label>
<select name="fund_name" id="fund_name" onchange="change(this.options[selectedIndex].value);">
<?php
if(isset($fund_name) && ($fund_name !="0"))
{
echo $options_fund .= '<option value="'.$new_fund_ID.'" selected="selected">'.$new_fund_name.'</option>';
//echo $options_fund;
}
else
{
?>
<option value="0">Select Fund Name</option>
<?php
//echo '<option value="'.$option_list[0].'">'.$option_list[1].'</option>';
echo $options_fund;
}
?>
</select><span class="tip"> 2/ Select Fund Name</span>
</p>
PART II - CODE PROCESSES THE SELECT MENU
// GET FUND NAME
$query_fund = "SELECT fund_ID, client_ID, fund_name ".
"FROM fund_name ".
"WHERE client_ID = '$client'";
echo '<p>Q: '.$query_fund.'</p>';
$result_fund = mssql_query($query_fund) or die('Select Fund Name Error');
$options_fund = ''; // SET OPTION VAR
while($row_fund = mssql_fetch_array($result_fund)) // LOOP RESULTS
{
$options_fund .= '<option value="'.$row_fund['fund_ID'].'">'.$row_fund['fund_name'].'</option>';
$new_fund_name = $row_fund['fund_name']; // SET SELECTED VALUE
$new_fund_ID = $row_fund['fund_ID']; // SET SELECTED VALUE
} // END WHILE