Mentor's Name NOT displaying

Hi there, I am doing the mentoring system I am having problem when I try to register a mentee into the system. The name of the “Mentor” I have chose from the ‘register page’ which in the drop down list form cannot be displayed. Once I click the register button, all the contents I have entered in the ‘Register Page’ appear in the ‘Register Confirmation Page’ except the mentor’s name.

Here the codes for the mentor’s name drop down list in the “Register Page”:


<select style="color: #009; font-family: Verdana, Geneva, sans-serif; font-size: 11px;" name="lect_id2" id="lect_id2">
  <?php do {?>
  <option value="<?php echo $row_addlectstu['lect_id']?>"<?php if (!(strcmp($row_addlectstu['lect_id'], $_REQUEST['lect_id']))) {echo "selected=\\"selected\\"";} ?>><?php echo($row_addlectstu['lect_name'])?></option>
  <?php
} while ($row_addlectstu = mysql_fetch_assoc($addlectstu));
$rows = mysql_num_rows($addlectstu);
if($rows > 0) {
mysql_data_seek($addlectstu, 0);
$row_addlectstu = mysql_fetch_assoc($addlectstu);
}
?>
</select>

Code that display the mentor’s name in “Register Confirmation page”:


<?php echo $lecturer_id=$_REQUEST['lect_id'];
$zzz = mysql_query("SELECT * FROM lecturer WHERE lect_id='$lecturer_id'");
if($zzz = mysql_fetch_assoc($zzz)){
echo $xxx=$zzz['lect_name'];}
?>

The codes do not prompt me any notices of index error or warning when i try to run my registering pages locally, the only problem is the mentor’s name not showing up in the “Register Confirmation Page”. :frowning:

I’ve rewritten your code so it might give you some more info about passed form values, query results, etc.


<?php 
  print_r($_REQUEST); echo 'br />';
  $lecturer_id = $_REQUEST['lect_id'];
  $query = "
    SELECT * 
    FROM lecturer 
    WHERE lect_id='$lecturer_id'
  " ;
  echo 'query : ' . $query . '<br />';
  $zzz = mysql_query($query) or die('mysql error: ' . mysql_error());
  if ($zzz = mysql_fetch_assoc($zzz)) {
    $xxx= $zzz['lect_name'];
    print_r($zzz);
  }
?>

Thanks man, I solved my problem. Have a nice day!