Jump to content

Need help


wolfwood16

Recommended Posts

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).

 

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

21186030va8.jpg

 
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

50820181iw2.jpg

 
$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):

 
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???

Link to comment
https://forums.phpfreaks.com/topic/125781-need-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.