hi
i want to make a page from which user select values from a drop down list and when user clicks on the submit button then values should go to database for validation and then user should be proceeded to another page.........
here is the code can any body help me in this........
<?PHP
$course = "";
$semister = "";
$errorMessage = "";
$num_rows = 0;
if ($_SERVER['REQUEST_METHOD'] == 'POST'){
$course = $_POST['course'];
$semister = $_POST['semister'];
$user_name = "root";
$pass_word = "";
$database = "attendance_system";
$server = "127.0.0.1";
$db_handle = mysql_connect($server, $user_name, $pass_word);
$db_found = mysql_select_db($database, $db_handle);
if ($db_found) {
$SQL = "SELECT * FROM course_semister WHERE course= $course AND semister= $semister ;
$result = mysql_query($SQL);
$num_rows = mysql_num_rows($result);
if ($result) {
if ($num_rows > 0) {
print "ok";
}
else {
print "this is not your class";
}
}
else {
$errorMessage = "please enter again";
}
mysql_close($db_handle);
}
else {
$errorMessage = "Error logging on";
}
}
?>
<html>
<body>
<div align="center">
<form name="input" action="attendance_system.html" method="post">
<table width="413" border="0">
<tr>
<td height="39">Course</td>
<td width="265"><select name="course">
<option value="select">Select-Course</option>
<option value="BE-ME">BE-ME</option>
<option value="BE-EE">BE-EE</option>
<option value="BE-IME">BE-IME</option></select>
</td>
<td>Semister</td>
<td>
<select name="semister">
<option value="select">Select-Semister</option>
<option value="1">Ist</option>
<option value="2">2nd</option>
<option value="3">3rd</option>
<option value="4">4th</option>
<option value="5">5th</option>
<option value="6">6th</option>
<option value="7">7th</option>
<option value="8">8th</option>
</select>
</td>
</tr>
</table>
<p align="center"><input type="submit" value="OK"/></p>
</form>
</div>
</body>
</html>