Hello,
I would like to edit a form which I already store the real value for the combo box. Then during editing session, it start reseting the combo box to the top list.
studentinfo.php
//Load Student Profile
if (!empty($_GET['student_id'])){
$result = mysql_query("SELECT * FROM student WHERE student_id =".$_GET['student_id']) or die(mysql_error());
$data = mysql_fetch_array($result);
$student_id = $data['student_id'];
$stu_fname = $data['stu_fname'];
$stu_lname = $data['stu_lname'];
$stu_email = $data['stu_email'];
$stu_address = $data['stu_address'];
$stu_telp = $data['stu_telp'];
$stu_hp = $data['stu_hp'];
$stu_wa = $data['stu_wa'];
$stu_skype = $data['stu_skype'];
$stu_facebook = $data['stu_facebook'];
$stu_twitter = $data['stu_twitter'];
$stu_picture = $data['stu_picture'];
$newfilename = $data['newfilename'];
$access_level_id = $data['access_level_id'];
}
else {
//echo "unable to select data".'<br>';
//echo "student_id is empty";
}
?>
<div align="center">
<div style="width:800px;text-align:left;">
<?php echo $confirmation;?>
<?php //echo $confirmation2;?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF'] .'?student_id='. $student_id;?>" enctype="multipart/form-data">
<!-- <input type="hidden" name="id" value="<?php// echo $id; ?>"/>-->
<table>
<tr>
<td>Student Picture</td>
<td>
<?php echo "<img src='../upload/".$newfilename."'>"; ?><br>
<input type="file" value="upload" name="file"/><br><br>
</td>
</tr>
<tr>
<td>Group Name</td>
<td>
<?php
$rs = mysql_query("SELECT * FROM `group`") or die(mysql_error());
echo "<select name='group_id'>";
while($data = mysql_fetch_array($rs)){
echo "<option value='".$data['group_id']."'>".$data['group_name']."</option>";
}
echo "</select>";
?>
</td>
</tr>
<tr>
<td>Access</td>
<td>
<?php
echo "<select name='access_level_id'>";
echo "<option value='3'>".'Student'."</option>";
echo "<option value='4'>".'Student Group Master'."</option>";
echo "</select>";
?>
</td>
</tr>
Check access! How to lock the access so that it shows the value that I have stored in the database(Student Group Master) instead of reseting the value to the top list (Student) ?