// session_start(); include 'TPGP_db.php'; // self post data $iCancel = $_POST['Cancel']; $Submit = $_POST['Submit']; $ReportID = $_POST['rid']; $StudentID = $_POST['sid']; $Attitude = $_POST['Attitude']; $Probation = $_POST['Probation']; $StartDate = $_POST['StartDate']; $EndDate = $_POST['EndDate']; $CreditsTPGP = $_POST['CreditsTPGP']; $CreditsOTHER = $_POST['CreditsOTHER']; $CreditsEarned = $_POST['CreditsEarned']; $CreditsTOTAL = $_POST['CreditsTOTAL']; $CreditsGOAL = $_POST['CreditsGOAL']; $CreditsRemainingToGOAL = $_POST['CreditsRemainingToGOAL']; /* Let's strip some slashes in case the user entered any escaped characters. */ $ReportID = stripslashes($ReportID); $StudentID = stripslashes($StudentID); $Attitude = stripslashes($Attitude); $Probation = stripslashes($Probation); $StartDate = stripslashes($StartDate); $EndDate = stripslashes($EndDate); $CreditsTPGP = stripslashes($CreditsTPGP); $CreditsOTHER = stripslashes($CreditsOTHER); $CreditsEarned = stripslashes($CreditsEarned); $CreditsTOTAL = stripslashes($CreditsTOTAL); $CreditsGOAL = stripslashes($CreditsGOAL); $CreditsRemainingToGOAL = stripslashes($CreditsRemainingToGOAL); // echo $PHP_SELF // THIS IS WHERE THE SELF POST FORM GOES // Define post fields into simple variables $iCancel = stripslashes($iCancel); if ($iCancel == "Cancel"){ $CURL = "TPGP_UpdateWeeklyReports.php?ID=" .$StudentID; header("Location:" .$CURL); } if ($Submit == "Update Report") { $sql2 = "UPDATE reports SET OnProbation='$Probation',StartDate='$StartDate',EndDate='$EndDate',CreditsTPGP='$CreditsTPGP',CreditsOTHER='$CreditsOTHER', CreditsEarned='$CreditsEarned',CreditsTOTAL='$CreditsTOTAL',CreditsGOAL='$CreditsGOAL',CreditsRemainingToGOAL='$CreditsRemainingToGOAL', Attitude='$Attitude' WHERE reportID=" .$ReportID; mysql_query($sql2); // print ".$sql2"; $FURL = "TPGP_UpdateWeeklyReports.php?ID=" .$StudentID; header("Location:" .$FURL); } else { // $PHP_SELF as the form action will cause the script to post to itself $ReportID = $_GET['ID']; $sql3="SELECT StudentID, StartDate, EndDate, Attitude, OnProbation,CreditsTPGP,CreditsOTHER,CreditsEarned,CreditsTOTAL,CreditsGOAL,CreditsRemainingToGOAL FROM reports WHERE reportID=" .$ReportID; $result3 = mysql_query($sql3); $nrows = mysql_num_rows($result3); $row = mysql_fetch_array($result3); echo '