the only code that should be moved is:
$colname_rsEmail = "-1";
if (isset($_POST['StudentEmail'])) {
$colname_rsEmail = $_POST['StudentEmail'];
}
mysql_select_db($database_steelguitar_se, $steelguitar_se);
$query_rsEmail = sprintf("SELECT * FROM student WHERE StudentEmail = %s", GetSQLValueString($colname_rsEmail, "text"));
$rsEmail = mysql_query($query_rsEmail, $steelguitar_se) or die(mysql_error());
$row_rsEmail = mysql_fetch_assoc($rsEmail);
$totalRows_rsEmail = mysql_num_rows($rsEmail);
the forgot password code should not be moved.