I have written something like this till now. I tried to added "@" symbol in order to avoid the error msg. But I do guess these is another better method.
For question (2), I tried to use javascript to send the variable to the same page. But what make me feel uncomfortable is I need to send $mail_outbox_no thru javascript.
I would like to seek for some advice to improve those 2 questions
<?
session_start();
include ('db.php');
$teacher_no = $HTTP_SESSION_VARS['teacher_no'];
$admin_flag = $HTTP_SESSION_VARS['admin_flag'];
$mail_outbox_no = $HTTP_GET_VARS['mail_outbox_no'];
@$class_no = $HTTP_GET_VARS['class_no'];
?>
<html>
<head>
<title>Mail Administration</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script language = "JavaScript">
function show_student() {
var class_no = document.class_form.class_no.value;
var mail_outbox_no = document.class_form.mail_outbox_no.value;
location.href = "select_recipient.php?class_no="+class_no+"&mail_outbox_no="+mail_outbox_no;
}
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" bgproperties="fixed" background="img/wallpaper_blue.jpg">
<b>Select Recipient(s)</b><br><br>
<?
if ($admin_flag == "T") {
$sql = "SELECT no, class_name from class WHERE school_no='$school_no' ORDER BY class_name";
} else {
$sql = "SELECT no, class_name from class WHERE teacher_no='$from_teacher' ORDER BY class_name";
}
$rs_query = mysql_query(($sql),$conn);
$no_of_class = mysql_num_rows($rs_query);
print "<b>Please select a class:</b><br>";
print "<form name=class_form>";
print "<select name='class_no' onChange='show_student()'>";
print "<option>Please select a class</option>";
for ($index=0;$index<$no_of_class;$index++) {
$arr[$index] = mysql_fetch_array($rs_query);
print "<option value='".$arr[$index]['no']."'>".$arr[$index]['class_name']."</opotion>";
}
print "</select>";
print "<input type='hidden' name=mail_outbox_no value=$mail_outbox_no>";
print "</form>";
print "<br>";
?>