Alanı 3 set olarak gelir.
İlk sitesi:
<?
session_start();
require_once 'opendb.php';
?>
<html>
<form action="student_details.php" method="post">
<img style="width: 190px; height: 184px;" alt=""
src="images/Picture1.jpg">
<body>
<span
style="text-decoration: underline; font-weight: bold;"> </span><big
style="font-weight: bold;"><big><big><big>Create New Class</big></big></big></big>
</head>
<?
echo "<td><h3>Application for Registration of
<select name='course_name' id='drop_down'></td><h3>";
$sql= "SELECT DISTINCT course_name FROM c_course";
$result=mysql_query($sql);
echo "</tr>";
while ($row = mysql_fetch_assoc($result))
{
echo "<option>";
echo $row['course_name'];
echo "</option>";
}
echo "</td>";
echo "</tr>";
?>
<table>
<tr>
<td>Venue of Class:</td>
<td><input type = 'text' name = 'class_venue'></td>
</tr>
<tr>
<td>Date of Commencement:</td>
<td><input type = 'text' name = 'date_of_lesson'></td>
</tr>
<tr>
<td>Other Dates of Lessons:</td>
<td><input type = 'text' name = 'other_lessons'></td>
<td><input type = 'text' name = 'other_lessons1'></td>
<tr>
<td>Time:</td><td><select name="time_of_lesson" id="drop_down">
<option value="0700">0700</option>
<option value="0800">0800</option>
<option value="0900">0900</option>
</tr>
<tr>
<td> Class Duration:</td><td><select name="class_duration" id="drop_down">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</tr>
<tr>
<td>Tentative Date of Exam:</td>
<td><input type = 'text' name = 'date_of_exam'></td>
<td>(DD-MM-YYYY)</td>
</tr>
<tr>
<td>Class-In-Charge:</td>
<td><input type = 'text' name = 'class_in_charge'></td>
</td>
<tr>
<td>Contact No:</td>
<td><input type = 'text' name = 'contact'></td>
</tr>
<tr>
<td>Email:</td>
<td><input type = 'text' name = 'email'></td>
</tr>
<?
$i=1;
echo "<tr>";
echo "<td><u>Choose Lecturer:</u></td>";
echo "</tr>";
echo "<tr>";
echo "<td>Zone:</td>";
echo "<td><select name='zone_no' id='drop_down'>";
$sql= "SELECT DISTINCT zone_no FROM c_lecturer";
$result=mysql_query($sql);
while ($row = mysql_fetch_assoc($result))
{
echo "<option>";
echo $row['zone_no'];
echo "</option>";
}
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td>Lecturer:</td>";
echo "<td><select name='cl_name' id='drop_down'>";
$sql= "SELECT cl_name FROM c_lecturer";
$result=mysql_query($sql);
while ($row = mysql_fetch_assoc($result))
{
echo "<option>";
echo $row['cl_name'];
echo "</option>";
}
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td>Examiner:</td>";
echo "<td><select name='ce_name' id='drop_down'>";
$sql= "SELECT ce_name FROM c_examiner";
$result=mysql_query($sql);
while ($row = mysql_fetch_assoc($result))
{
echo "<option>";
echo $row['ce_name'];
echo "</option>";
}
echo "</td>";
echo "</tr>";
?>
<br>
<br>
<tr>
<td><input type = 'submit' name="StudentDetails" value = "Continue"></td>
</tr>
</table>
</form>
</body>
</html>
İkincisi
<?php
error_reporting(E_ALL ^ E_NOTICE);
session_start();
require_once 'opendb.php';
if (isset($_POST['AddStudent'])) {
// If user click on Add new student button
$temp = $_SESSION['numberOfStudents'];
$temp = $temp + 1;
$_SESSION['numberOfStudents'] = $temp;
}
/*else if (isset($_POST['FinalCheckBtn'])) {
// If user click on Final Check button go to Final check page
header('Location: http://localhost/SJAA/final_check.php') ;
}*/
else {
// if User enter this page the first time from "create new class page "
// the variable that hold the credentials to connect to the database
// Read variables from the $_POST array
$class_name = $_POST['course_name'];
$class_venue = $_POST['class_venue'];
$date_of_lesson =$_POST['date_of_lesson'];
$time_of_lesson =$_POST['time_of_lesson'];
$class_duration =$_POST['class_duration'];
$date_of_exam =$_POST['date_of_exam'];
$class_in_charge =$_POST['class_in_charge'];
$contact =$_POST['contact'];
$email =$_POST['email'];
$zone =$_POST['zone_no'];
$cl_name =$_POST['cl_name'];
$ce_name =$_POST['ce_name'];
// Prepare the query
$sql = "INSERT INTO b_class (class_name,class_venue,date_of_lesson,time_of_lesson,class_duration,date_of_exam,class_in_charge,contact,email,zone_no, cl_name,ce_name) VALUES
('$class_name','$class_venue','$date_of_lesson','$time_of_lesson','$class_duration','$date_of_exam','$class_in_charge','$contact','$email','$zone_no','$cl_name','$ce_name')";
// Execute the query
mysql_query($sql) or die(mysql_error());
$_SESSION['numberOfStudents'] = 0;
$_SESSION['class_name']=$_POST['course_name'];
$_SESSION['class_venue'] = $_POST['class_venue'];
$_SESSION['date_of_lesson'] = $_POST['date_of_lesson'];
$_SESSION['time_of_lesson'] = $_POST['time_of_lesson'];
$_SESSION['class_duration'] = $_POST['class_duration'];
$_SESSION['date_of_exam'] = $_POST['date_of_exam'];
$_SESSION['class_in_charge'] = $_POST['class_in_charge'];
$_SESSION['contact'] = $_POST['contact'];
$_SESSION['email'] = $_POST['email'];
$_SESSION['zone_no'] = $_POST['zone_no'];
$_SESSION['cl_name'] = $_POST['cl_name'];
$_SESSION['ce_name'] = $_POST['ce_name'];
// Prepare query to get the new class id
$sql = "select max(b_class_id) as ClassId from b_class";
$result = mysql_query($sql) or die(mysql_error());
if (mysql_num_rows($result) > 0) {
$row = mysql_fetch_row($result);
$_SESSION['class_id'] = $row[0];
}
}
?>
<html>
<form enctype="multipart/form-data" action = 'student_details.php' method='post'>
<img style="width: 190px; height: 184px;" alt="" src="images/Picture1.jpg">
<head><title>Students' Particulars</title></head>
<h1>Students' Particulars</h1>
<h3> Please enter student's particulars. All fields are to be filled. </h3>
<table style="text-align: left; width: 333px; height: 144px;"
border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td><?php
echo "Class Name: ";
echo $_SESSION['class_name'];?> </td>
</tr>
<tr>
<td><?php
echo "Class Id: ";
echo $_SESSION['class_id'];?> </td>
</tr>
<tr>
<td><?php
echo "Class Venue: ";
echo $_SESSION['class_venue'];?> </td>
</tr>
<tr>
<td><?php
echo "Date of Commencement: ";
echo $_SESSION['date_of_lesson'];?> </td>
</tr>
<tr>
<td><?php
echo "Time: ";
echo $_SESSION['time_of_lesson'];?> </td>
</tr>
<tr>
<td><?php
echo "Class Duration: ";
echo $_SESSION['class_duration'];?> </td>
</tr>
<tr>
<td><?php
echo "Tentative Date of Exam: ";
echo $_SESSION['date_of_exam'];?> </td>
</tr>
<tr>
<td><?php
echo "Class-In-Charge: ";
echo $_SESSION['class_in_charge'];?> </td>
</tr>
<tr>
<td><?php
echo "Contact: ";
echo $_SESSION['contact'];?> </td>
</tr>
<tr>
<td><?php
echo "Email: ";
echo $_SESSION['email'];?> </td>
</tr>
<tr>
<td><?php
echo "Zone: ";
echo $_SESSION['zone_no'];?> </td>
</tr>
<tr>
<td><?php
echo "Lecturer: ";
echo $_SESSION['cl_name'];?> </td>
</tr>
<tr>
<td><?php
echo "Examiner: ";
echo $_SESSION['ce_name'];?> </td>
</tr>
</tr>
<body>
<table border="1">
<tr>
<th>Name</th>
<th>NRIC no.</th>
<th>Age</th>
</tr>
<br>
<input type="submit" value="Add new Student" name="AddStudent">
</form>
<?php
$cnt = 0;
echo "<form enctype='multipart/form-data' action = 'final_check.php' method='post'>";
while ($cnt < $_SESSION['numberOfStudents']) {
$NameCnt = "Name".$cnt;
$NRICcnt = "NRICno".$cnt;
$AgeCnt = "Age".$cnt;
if (isset($_POST[$NameCnt])) {
?>
<tr>
<td><input type = 'text' name = 'student_name<?php echo $cnt ?>' value='<?php echo $_POST[$NameCnt] ?>'></td>
<td><input type = 'text' name = 'nric<?php echo $cnt ?>' value='<?php echo $_POST[$NRICcnt] ?>'></td>
<td><input type = 'text' name = 'age<?php echo $cnt ?>' value='<?php echo $_POST[$AgeCnt] ?>'></td>
</tr>
<?php
}
else {
?>
<tr>
<td><input type = 'text' name = 'student_name<?php echo $cnt ?>'></td>
<td><input type = 'text' name = 'nric<?php echo $cnt ?>'></td>
<td><input type = 'text' name = 'age<?php echo $cnt ?>'></td>
</tr>
<?php
}
$cnt = $cnt +1;
}
?>
</table>
<tr>
<td></td>
<table style="text-align: left;"
<td><input type = 'submit' value = 'Submit' name='FinalCheckBtn'></td>
</tr>
</table>
</form>
</html>
Final biri benim ilk yazı üzerine biridir.