hi there,
i have a program in which a student will check his failed subjects on the previous semester and see the result on the next page. The next page will provide him the next semester's set of subjects and will tell him if there were subjects he need to comply first on the first semester. The output will be (Allowed/Not Allowed).
[img]http://img72.imageshack.us/img72/7214/21186030va8.jpg[/img]
The image shows where the previous semester's subjects appear and where the student check his failed subjects:
And its codes:
echo "<form name='AssessMe' method='post' action='result.php'>";
$retrieveFirstSem = "SELECT * FROM curr_subjs WHERE subj_sem = '1' AND subj_curr = '".$_SESSION['selectedCurr']."' AND subj_level = '1' AND subj_desc != ''";
$returnFS = mysql_query($retrieveFirstSem) or die(mysql_error());
while($fs = mysql_fetch_array($returnFS)){
echo "<tr>";
echo " <td width=\"2%\" style=\"background:#ffffff; color:#333333; padding-left: 5px;\"> <input type='checkbox' name='checkBox[]' value='$fs[id]'> </td>";
echo " <td width='8%' style=\"background:#ffffff; color:#333333; padding-left: 5px;\"> $fs[subj_code] </td>";
echo " <td width='30%' style=\"background:#ffffff; color:#333333; padding-left: 5px;\"> $fs[subj_desc] </td>";
echo " <td width='8%' style=\"background:#ffffff; color:#333333; padding-left: 5px;\"> $fs[lec_hrs] </td>";
echo " <td width='8%' style=\"background:#ffffff; color:#333333; padding-left: 5px;\"> $fs[lab_hrs] </td>";
echo " <td width='8%' style=\"background:#ffffff; color:#333333; padding-left: 5px;\"> $fs[subj_units] </td>";
echo " <td width='8%' style=\"background:#ffffff; color:#333333; padding-left: 5px;\"> $fs[subj_preq] </td>";
echo "</tr>";
}
echo "<br><br><input type='submit' value='Assess Me' class=\"assessbutt\">";
echo "<input type='hidden' name='isAssessing' value='yes'>";
echo "</form>";
This is the result page, where the student will see the next semester
[img]http://img223.imageshack.us/img223/8941/50820181iw2.jpg[/img]
And its codes
$retrieveSecondSem = "SELECT * FROM curr_subjs WHERE subj_sem = '2' AND subj_curr = '".$_SESSION['selectedCurr']."' AND subj_level = '1' AND subj_desc != ''";
$returnSS = mysql_query($retrieveSecondSem) or die(mysql_error());
while($Ss = mysql_fetch_array($returnSS)){
echo "<tr>";
echo " <td width='8%' style=\"background:#ffffff; color:#333333; padding-left: 5px;\"> $Ss[subj_code] </td>";
echo " <td width='30%' style=\"background:#ffffff; color:#333333; padding-left: 5px;\"> $Ss[subj_desc] </td>";
echo " <td width='8%' style=\"background:#ffffff; color:#333333; padding-left: 5px;\"> $Ss[lec_hrs] </td>";
echo " <td width='8%' style=\"background:#ffffff; color:#333333; padding-left: 5px;\"> $Ss[lab_hrs] </td>";
echo " <td width='8%' style=\"background:#ffffff; color:#333333; padding-left: 5px;\"> $Ss[subj_units] </td>";
echo " <td width='8%' style=\"background:#ffffff; color:#333333; padding-left: 5px;\"> $assessStatus </td>";
echo "</tr>";
}
This is the code to return the checked failed subjects and search for a subjects requiring that failed subjects (Pre Requisite):
if ($_POST['checkBox']) {
include_once '../../admin_/conn.php';
$chckbx = $_POST['checkBox'];
$assessStatus = "Allowed";
foreach ($chckbx as $c){
//echo $c."<br />";
//find the subjs
$FindSubj = "SELECT * FROM curr_subjs WHERE id = '$c'";
$FindSubjNow = mysql_query($FindSubj) or die(mysql_error());
$FindSubjHandler = mysql_fetch_array($FindSubjNow);
//and get the parallel
$getParallel = "SELECT subj_code FROM curr_subjs WHERE subj_preq = '".$FindSubjHandler['subj_code']."' AND subj_sem = '2' AND subj_level = '1'";
$getParallelNow = mysql_query($getParallel) or die(mysql_error());
$ParallelHandler = mysql_fetch_array($getParallelNow);
if ($ParallelHandler>0) {
// if the checked failed subject is parallel to 2nd semester, return
$assessStatus = "Not Allowed";
}
}
}
As you can see, As ive checked the ENGL01, MATH01, and MATH02, the result page is returning "Allowed" for the subject ENGLO2, MATH04 and COMP02. But these are their pre requisites....
why is this so?? anyone please???