// This script performs an INSERT query to add a record to the users table.
$page_title='Course Grade';
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 email address:
if(empty($_POST['last_name'])){//$_POST is a global variable. empty() method determines whether a variable is considered to be empty.
$errors[]='You forgot to enter the last name';
}else{
$ln=mysqli_real_escape_string($dbc,trim($_POST['last_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.
// Make the query:
$q="SELECT CONCAT (StuLastName, ', ', StuFirstName) AS name, CouLongName AS course,CourseGrades AS grade FROM Students, Courses, StudentClass, ScheduleOfClasses