// session_start();
include 'TPGP_db.php';
// self post data
$Subject = $_POST['SubjectId'];
$ClassName = $_POST['ClassName'];
$Description = $_POST['Description'];
$LastRevision = $_POST['LastRevision'];
$RevisedBy = $_POST['RevisedBy'];
$Credits = $_POST['Credits'];
/* Let's strip some slashes in case the user entered
any escaped characters. */
$Subject = stripslashes($Subject);
$ClassName = stripslashes($ClassName);
$Description = stripslashes($Description);
$LastRevision = stripslashes($LastRevision);
$RevisedBy = stripslashes($RevisedBy);
$Credits = stripslashes($Credits);
// echo $PHP_SELF
// THIS IS WHERE THE SELF POST FORM GOES
// Define post fields into simple variables
if (($Subject) && ($ClassName)) {
$sql2 = "INSERT into classes (SubjectId,ClassName,ClassDescription,LastRevision,RevisedBy,Credits) VALUES ('$Subject','$ClassName','$Description','$LastRevision','$RevisedBy','$Credits')";
mysql_query($sql2);
// print "success - .$sql2";
// print "To Create A New Class, click here.";
// END IF greater than one row found inthe class list.
} else {
// $PHP_SELF as the form action will cause the script to post to itself
} // END ELSE IF
echo "";
echo "
|
Turning Point at Granita Park
Student Administration
System
Add / Edit Classes
Click here to return to the main administration page!
|
|
";
$sql="SELECT subject.Subject, subject.SubjectID, classes.* FROM classes LEFT JOIN subject ON classes.SubjectId = subject.SubjectID ORDER BY subject.Subject, classes.ClassName";
$result = mysql_query($sql);
$nrows = mysql_num_rows($result);
if($nrows != 0)
{
print "";
print "";
print "FUNCTION | ";
print "";
print "Subject | ";
print "";
print "Class Name | ";
print "";
print "Class Description | ";
print "";
print "Last Revision | ";
print "";
print "Revised By | ";
print "";
print "Credits | ";
print "
>";
for($j=0;$j<$nrows;$j++)
{
$row = mysql_fetch_array($result);
$EditURL = "TPGP_EditClass.php?ID=" . $row['ClassId'];
$DeleteURL = "TPGP_DeleteClass.php?ID=" . $row['ClassId'];
$UnitsURL = "TPGP_EditUnits.php?ID=" . $row['ClassId'];
print " UNITS";
print " | EDIT";
print " | DELETE";
print " | " . $row["Subject"];
print " | " . $row["ClassName"];
print " | " . $row["ClassDescription"];
print " | " . $row["LastRevision"];
print " | " . $row["RevisedBy"];
print " | " . $row["Credits"];
print "\n";
}
print " |
\n";
}
$list_comp = $row["SubjectID"];
$sql4="SELECT SubjectID,Subject from subject";
$result4 = mysql_query($sql4)
or die("error in SQL");
echo '';
print "Click here to return to the main administration page!";
// THIS IS WHERE THE SELF POST FORM ENDS
// mysql_close($dbcon);
?>