Page 1
<?php session_start();
$_SESSION['course'] = $_POST['course'];
$_SESSION['course']= $course;
?>
<script type="text/javascript">
<!--
function validate_form ( )
{
valid = true;
if ( document.course.course.selectedIndex == 0 )
{
alert ( "Please select a course." );
valid = false;
}
return valid;
}
//-->
</script>
<html>
<head>
<title>Register</title>
</head>
<body leftmargin="0" topmargin="0">
<form action="Date.php" name="course" method="post" onsubmit="return validate_form()">
<table align="center" width = "300%">
<tr>
<td align = "center">
<h2>SJAS -Select Course</h2>
<h4>Please Choose the Course you wish to enroll in .</h4>
<h2>Course Selection</h2>
<hr>
</td>
</tr>
<tr>
</table>
<table align = "center">
<tr>
<td>
<select name="course" value="course" id="course">
<option value="value1"selected="selected" >--Select Course--</option>
<option value="Basic Cardiac Life Support">Basic Cardiac Life Support</option>
<option value="CPR">CPR</option>
<option value="Basic First Aid">Basic First Aid</option>
<option value="Adult First Aid">Adult First Aid</option>
<option value="Home and Nursing">Home and Nursing</option>
</select>
</td>
</tr>
</table>
<br>
<center> <input name="submit" type="submit" value="Next" /></center>
</form>
</body>
</html>
Page 5
<?php session_start();
if(isset($_POST)){
$no=$_POST['no'];
echo $_POST['course'];
$_SESSION['course'] = $_POST['course'];
$link = mysqli_connect('localhost', 'root', '', 'sjas')or die(mysqli_connect_error());
for($count=1;$count<=$no;$count++)
{
$fullname=$_POST['fullname'.$count];
$nric=$_POST['nric'.$count];
$age=$_POST['age'.$count];
$gender=$_POST['gender'.$count];
$email=$_POST['email'.$count];
$position=$_POST['position'.$count];
$sdf=$_POST['sdf'.$count];
$course= $_POST['course'.$count];
$count= $count++;
$query = "INSERT INTO employee(fullname,nric,age,gender,email,position,sdf,course) VALUES ('$fullname','$nric','$age','$gender','$email','$position','$sdf','.$course.')";
$status = mysqli_query($link,$query) or die(mysqli_error($link));
}}
mysqli_close($link);
?>
<head>
<title>Register</title>
</head>
<body leftmargin="0" topmargin="0">
<form action="email.php" method="post" >
<table align="center" width = "300%">
<tr>
<td align = "center">
<h2>SJAS -Confirm</h2>
<h4>Please confirm that you wish to continue .</h4>
<?php
echo $message;
?>
<hr>
</td>
</tr>
</table>
<br>
<table align="center">
<tr>
<td><input name="submit" type="submit" value="Confirm" /></td>
<td> <input type=button onclick="location.href='home.php'" value='Cancel'> </td>
</tr>
</table>
</form>
</html>

New Topic/Question
Reply



MultiQuote





|