hi all,
In my page i had a highest education qualification section and 2nd Highest Qualification
1.In HIghest qualification i had course and Year of pass as dropdown fields
2 In 2nd Highest qualification i had course and Year of pass as dropdown fields same as highest qualification.

Now i had inserted the selected values into database.They will be stored in Education details table as two rows.

Here is my problem I had some Edit page where i need to show these two rows as selected in dropdown but i am not getting it... so can any one help me please..

i tried this.

<?php $query2= mysql_query("SELECT * FROM Education where Emp_No='$id'");
mysql_error();
$num2=mysql_num_rows($query2);
$j=0;
while ($j < $num2){
$f1=mysql_result($query2,$j,"Course");
$f2=mysql_result($query2,$j,"Pass_year");
 ?>
<tr>
<td align="right"> Course: </td>
<td align="left">
<select name="course1" onchange="javascript: ToogleTextbox(this.value == '');" >
<option value="<?php echo $f1;?>" selected="selected"><?php echo $f1;?> </option>
<option value="12th">12th</option>
<option value="Aviation">Aviation</option>
<option value="B.A">B.A.</option>
<option value="B.Arch">B.Arch</option>
<option value="B.Com">B.Com</option>
</select>
</td>
</tr>
 <tr>
 <td align="right"> Year Of Passing: </td>
 <td align="left"><select name="yearofpassing1" id="year1">
 <option value="<?php echo $f2;?>" selected="selected"><?php echo $f2;?></option>
 <option value="2010">2010</option><option value="2009">2009</option><option value="2008">2008</option><option value="2007">2007</option>
</td>
</tr>
<tr>
<td align="right"> Course: </td>
<td align="left">
<select name="course2" onchange="javascript: ToogleTextbox(this.value == '');" >
<option value="<?php echo $f1;?>" selected="selected"><?php echo $f1;?> </option>
<option value="12th">12th</option>
<option value="Aviation">Aviation</option>
<option value="B.A">B.A.</option>
<option value="B.Arch">B.Arch</option>
<option value="B.Com">B.Com</option>
</select>
</td>
</tr>
 <tr>
 <td align="right"> Year Of Passing: </td>
 <td align="left"><select name="yearofpassing2" id="year2">
 <option value="<?php echo $f2;?>" selected="selected"><?php echo $f2;?></option>
 <option value="2010">2010</option><option value="2009">2009</option><option value="2008">2008</option><option value="2007">2007</option>
</td>
</tr>
<?php
$j++;
}
?>

thank u....

Hey try this,

for all option should be like this....

<option value="12th" <?php if ($f1 == '12th') { echo 'selected="selected"';}?>>12th</option>
<option value="Aviation" <?php if ($f1 == 'Aviation') { echo 'selected="selected"';}?>>Aviation</option>
<option value="B.A" <?php if ($f1 == 'B.A') { echo 'selected="selected"';}?>>B.A</option>
<option value="B.Arch" <?php if ($f1 == 'B.Arch') { echo 'selected="selected"';}?>>B.Arch</option>
<option value="B.Com" <?php if ($f1 == 'B.Com') { echo 'selected="selected"';}?>>B.Com</option>

<option value="2010" <?php if ($f2 == '2010') { echo 'selected="selected"';}?>>2010</option>
<option value="2009" <?php if ($f2 == '2009') { echo 'selected="selected"';}?>>2009</option>
<option value="2008" <?php if ($f2 == '2008') { echo 'selected="selected"';}?>>2008</option>
<option value="2007" <?php if ($f2 == '2007') { echo 'selected="selected"';}?>>2007</option>

Hope this will help you ... :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.