session_start();
// echo $_SESSION['usersname'];
// echo $_SESSION['usersid'];
// used the echos above for testing purposes
// session_start();
include 'TPGP_db.php';
// self post data
$iCancel = $_POST['Cancel'];
$Submit = $_POST['Submit'];
$TherapyID = $_POST['rid'];
$StudentID = $_POST['sid'];
$Description = $_POST['description'];
$EndDate = $_POST['EndDate'];
/* Let's strip some slashes in case the user entered
any escaped characters. */
$TherapyID = stripslashes($TherapyID);
$StudentID = stripslashes($StudentID);
$Description = stripslashes($Description);
$EndDate = stripslashes($EndDate);
$iCancel = stripslashes($iCancel);
$theStudentID = $_SESSION['usersid'];
$sql = mysql_query("SELECT * FROM users WHERE userid='$theStudentID'");
$record_found = mysql_num_rows($sql);
if($record_found > 0){
while($row = mysql_fetch_array($sql)){
foreach( $row AS $key => $val ){
$$key = stripslashes( $val );
} // END FOR
echo "
View Student Program Details Information
STUDENT INFORMATION : |
Name : $first_name $last_name |
Login : $username |
Email : $email_address |
";
$query="SELECT * FROM reports WHERE (StudentID ='$theStudentID' AND CreditsTOTAL > 0) ORDER BY EndDate DESC LIMIT 1";
// print "$query";
$result=mysql_query($query);
$num=mysql_numrows($result);
$i=0;
while ($i < $num) {
$row99=mysql_fetch_array($result);
$CC = $row99["CreditsTPGP"];
// print "$CC";
$CO = $row99["CreditsOTHER"];
// print "$CO";
$CT = $row99["CreditsTOTAL"];
$CG = $row99["CreditsGOAL"];
// CODE
echo '
Credits Completed (TPGP) : '.$CC.' |
Credits Completed (OTHER) : '.$CO.' |
Credits Total : '.$CT.' |
Credits Goal : '.$CG.'
|
';
$i++;
} // END WHILE INNER LOOP RECORDSET - last report
} // END WHILE
echo ' |
';
} // END IF
else {
echo "Session Variables Timed Out - Please login again.";
}
if ($Submit == "Update Therapy") {
$sql2 = "UPDATE therapy SET EndDate='$EndDate',description='$Description' WHERE therapyID=" .$TherapyID;
mysql_query($sql2);
// print ".$sql2";
$FURL = "TPGP_UpdateWeeklyPrograms.php?ID=" .$StudentID;
header("Location:" .$FURL);
} else {
// $PHP_SELF as the form action will cause the script to post to itself
if ($iCancel == "Return"){
$CURL = "TPGP_ViewStudentProgram.php?ID=" .$StudentID;
header("Location:" .$CURL);
}
else {
$TherapyID = $_GET['ID'];
$sql3="SELECT StudentID, EndDate, description FROM therapy WHERE therapyID=" .$TherapyID;
$result3 = mysql_query($sql3);
$nrows = mysql_num_rows($result3);
$row = mysql_fetch_array($result3);
echo '';
}
} // end else - not cancel
?>