// session_start(); include 'TPGP_db.php'; // self post data $iCancel = $_POST['Cancel']; $theSubjectId = $_POST['theSubjectId']; $Subject = $_POST['Subject']; $theSubjectId = stripslashes($theSubjectId); $Subject = stripslashes($Subject); // echo $PHP_SELF // THIS IS WHERE THE SELF POST FORM GOES // Define post fields into simple variables $iCancel = stripslashes($iCancel); if ($iCancel == "Cancel"){ header("Location: TPGP_EditSubjects.php"); } if (($Subject) && ($theSubjectId)) { $sql2 = "UPDATE subject SET Subject='$Subject' WHERE SubjectID=" .$theSubjectId; mysql_query($sql2); header("Location: TPGP_EditSubjects.php"); } else { // $PHP_SELF as the form action will cause the script to post to itself $SubjectID = $_GET['ID']; $sql3="SELECT Subject, SubjectID FROM subject WHERE SubjectID=" .$SubjectID; $result3 = mysql_query($sql3); $nrows = mysql_num_rows($result3); $row = mysql_fetch_array($result3); $list_comp = $row["SubjectID"]; $sql4="SELECT SubjectID,Subject from subject"; $result4 = mysql_query($sql4) or die("error in SQL"); echo '