Please help...Student Subject Assessment

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
wolfwood16
Forum Commoner
Posts: 43
Joined: Wed Aug 27, 2008 8:52 am
Contact:

Please help...Student Subject Assessment

Post by wolfwood16 »

hi there,

Student Subject Assessment will enable a student to 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).

This is the page where the previous semester's subjects appear and where the student check his failed subjects:
Image

Code: Select all

 
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
Image

Code: Select all

 
$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;\"> [color=#800000]$assessStatus[/color] </td>";
                        
                        echo "</tr>";                       
                    }
This is the code to return the checked failed subjects and search for a subjects requiring that failed subjects (Pre Requisite):

Code: Select all

 
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???
Last edited by wolfwood16 on Thu Sep 25, 2008 9:00 am, edited 2 times in total.
wolfwood16
Forum Commoner
Posts: 43
Joined: Wed Aug 27, 2008 8:52 am
Contact:

Re: Please help...Student Subject Assessment

Post by wolfwood16 »

:cry: can somebody help me please.....
wolfwood16
Forum Commoner
Posts: 43
Joined: Wed Aug 27, 2008 8:52 am
Contact:

Re: Please help...Student Subject Assessment

Post by wolfwood16 »

this is what i want to do, if the student checked his failed subjects on the last semester, the next page will show the subjects for the next semester and will give him what subjects are requiring his checked failed subjects.

My sql table has these fields:

Code: Select all

 
id
subj_code = Subject Code
subj_desc = Subject Description
lec_hrs = Lecture Hours
lab_hrs = Lab Hours
subj_units = Subject Units
subj_sem = Subject Semester
subj_preq = Subject Pre Requisites
Now, i can get the value of his checked failed subjects through the foreach() loop. I can also show the subjects for the next semester through the while() loop.

What i am asking is that, how will i able to give the result to each second semester subjects if the pre-requisite subjects on the first semester was checked? The result should be Not Allowed and Allowed.

Please refer to my screenshots for more details
Post Reply