// session_start();
include 'TPGP_db.php';
// self post data
// $SubjectID = $_POST['SubjectID'];
$Subject = $_POST['Subject'];
/* Let's strip some slashes in case the user entered
any escaped characters. */
// $SubjectID = stripslashes($SubjectID);
$Subject = stripslashes($Subject);
// echo $PHP_SELF
// THIS IS WHERE THE SELF POST FORM GOES
// Define post fields into simple variables
if ($Subject) {
$sql2 = "INSERT into subject (Subject) VALUES ('$Subject')";
mysql_query($sql2);
// print "success - .$sql2";
echo "";
echo "
|
Turning Point at Granita Park
Student Administration
System
Add / Edit Subject |
|
";
$sql="SELECT Subject, SubjectID FROM subject";
$result = mysql_query($sql);
$nrows = mysql_num_rows($result);
if($nrows != 0)
{
print "";
print "";
print "FUNCTION | ";
print "";
print "SubjectID | ";
print "";
print "Subject | ";
print "
>";
for($j=0;$j<$nrows;$j++)
{
$row = mysql_fetch_array($result);
$EditURL = "TPGP_EditSubject.php?ID=" . $row['SubjectID'];
$DeleteURL = "TPGP_DeleteSubject.php?ID=" . $row['SubjectID'];
$ClassesURL = "TPGP_EditClasses.php?ID=" . $row['SubjectID'];
print " EDIT";
print " | DELETE";
print " | " . $row["SubjectID"];
print " | " . $row["Subject"];
print "\n";
}
print " |
\n";
echo '';
} // 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
echo "";
echo "
|
Turning Point at Granita Park
Student Administration
System
Add / Edit Subject
Click here to return to the main administration page!
|
|
";
$sql="SELECT Subject, SubjectID FROM subject";
$result = mysql_query($sql);
$nrows = mysql_num_rows($result);
if($nrows != 0)
{
print "";
print "";
print "FUNCTION | ";
print "";
print "SubjectID | ";
print "";
print "Subject | ";
print "
>";
for($j=0;$j<$nrows;$j++)
{
$row = mysql_fetch_array($result);
$EditURL = "TPGP_EditSubject.php?ID=" . $row['SubjectID'];
$DeleteURL = "TPGP_DeleteSubject.php?ID=" . $row['SubjectID'];
$ClassesURL = "TPGP_EditClasses.php?ID=" . $row['SubjectID'];
print " EDIT";
print " | DELETE";
print " | " . $row["SubjectID"];
print " | " . $row["Subject"];
print "\n";
}
print " |
\n";
echo '';
} // End If
} // END ELSE
echo "Click here to return to the Main
Administration Page!";
?>