// This script performs an INSERT query to add a record to the users table.
$page_title='Class Roster';
include('includes/header.html');
// Check for form submission:
// echo $_SERVER['REQUEST_METHOD'];
if($_SERVER['REQUEST_METHOD']=='POST'){//remember the difference between post and get?
require('./mysqli_connect.php');// Connect to the db.
$errors=array();// Initialize an error array.
// Check for an courese information:
if(empty($_POST['course_name'])){//$_POST is a global variable. empty() method determines whether a variable is considered to be empty.
$errors[]='You forgot to enter the course name';
}else{
$fn=mysqli_real_escape_string($dbc,trim($_POST['course_name']));//mysqli_real_escape_strin()escapes special characters in a string for use in an SQL statement.
}
if(empty($errors)){// If there is no errors. If everything's OK.
$q="SELECT CouLongName, CONCAT(SemesterName, Semesters.SemesterYear) as SemesterInf, CONCAT(StuLastName, ', ', StuFirstName) as name from Students, Semesters, Courses, StudentClass, ScheduleOfClasses