0

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....

Edited by niths: n/a

2
Contributors
1
Reply
12
Views
6 Years
Discussion Span
Last Post by fornandakishore
0

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 ... :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.