SitePoint Sponsor

User Tag List

Results 1 to 1 of 1

Thread: HELP PLEASE! :(

  1. #1
    SitePoint Member
    Join Date
    Nov 2012
    Location
    Philippines
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    HELP PLEASE! :(

    hi. can you please help me.. im doing my thesis and its due on monday.. but there's a problem that i can fix..

    this is my thesis.. a student portal wherein you can view your grades online and allow you to reserve subject.

    HERE'S MY PROBLEM..
    http://sphotos-g.ak.fbcdn.net/hphoto...80041147_n.jpg

    Code:
    <html>
    <head>
    <link href="tablesr.css" rel="stylesheet" type="text/css">
    <title>Subject Reservation</title>
    <script src="jquery1.8.js"></script>
    </head>
    <body>
    <style type="text/css">
    body {
    	font-family:verdana,arial,sans-serif;
    	font-size:10pt;
    	margin:10px;
    	background-image:url('http://localhost/tcmc/frames/bg.jpg');
    	-moz-background-size:600px 400px; /* Firefox 3.6 */
    background-size:670px 375px;
    background-repeat:no-repeat;
    background-attachment:fixed;
    	}
    </style>
    <center>
    <?php
    error_reporting(0);
    	session_start();
    	$welcomeuser = $_SESSION['uname'];
    	?>
    	
    	
    <?php
    include 'connect.php';
    
    $query = ("SELECT * FROM stud_info WHERE StudentNumber = '$welcomeuser'");
    $result = mysql_query($query);
    while($row = mysql_fetch_array($result))
    	
    	 echo "<font size=5>" . "<b>".$row['Year'] . "</b>". "</font>" ."<br>". $row['Major'] ."<br>" .$row['Block']. $row['SchoolYear'] . "<br>" .$row['Semester'] ." Semester" . "<br>" ."<b><u>" ;   
    	 ?>
    <?php
    	/**REQUIRE THE USER TO LOGIN FIRST**/
    		include 'connect.php';
    		if (isset($_SESSION['uname']))
    		echo "";
    		else
    		die("<b>Access Forbidden!<br>Click <a href='login.php'><b>here</b></a> to sign in. Thank you!</p>");
    ?>
    <center>
    <form action="subjectreservation2.php" method="POST">
    <?php
    include 'connect.php';
    $query = ("SELECT * FROM stud_info WHERE StudentNumber = '$welcomeuser'");
    $result = mysql_query($query);
    $row = mysql_fetch_array($result);
    
    echo  "<h4>Available Units:" . "<input type='text' id='availUnits' value=$row[AUnits] readonly='readonly' size=1  name='units'></h4>";
    ?>
    	
    
    <div class="CSSTableGenerator">
    <table border=3 align="center">
    <tr>
    <td></td>
    <td>Subject</td>
    <td>Day</td>
    <td>Time</td>
    <td>Descriptive Title</td>
    <td>Units</td>
    <td>Room</td>
    <td>Available Slot</td>
    </tr>
    <center>
    <?php
    
    include 'connect.php';
    $units = $_POST['units'];
    $welcomeuser = $_SESSION['uname'];
    $query = ("SELECT schedule.course, stud_info.course, stud_info.major, schedule.major, schedule.Year, stud_info.Year, schedule.Block, stud_info.Block, stud_info.StudentNumber , schedule.Day, schedule.Time, schedule.Subject, schedule.SubjectCode, schedule.DescriptiveTitle, schedule.Slot, schedule.Room, schedule.Units FROM schedule, stud_info WHERE schedule.Year = stud_info.Year AND stud_info.Semester = schedule.Semester AND stud_info.StudentNumber = '$welcomeuser' AND stud_info.course = schedule.course AND stud_info.Block = schedule.Block AND stud_info.Major = schedule.Major");
    $result = mysql_query($query);
    
    
    while($row = mysql_fetch_array($result))
    {
    
    	echo "<tr><td> <input type='checkbox' class='units' name='yes[]' value='".$row['Units'] . "<td>" . $row['Subject'] . $row['SubjectCode'] . "<td>" . $row['Day'] . "<td>" . $row['Time']. "<td>" . $row['DescriptiveTitle'] . "<td>" . $row['Room']. "<td>" . $row['course']. "<td>" . $row['Year']."'>" . "<td>" .  $row['Subject'] . $row['SubjectCode'] . "</td><td> " .$row['Day'] . "</td><td> " . $row['Time'] . "</td><td> " . $row['DescriptiveTitle'] . " </td><td> " . $row['Units'] . " </td><td> " . $row['Room'] . "</td><td>" . "<input type='text' id='ASLot' value=$row[Slot] readonly='readonly' size=1  name='Slot'>";
    	echo "<br>";
    	}
    echo "</table>";
    
    		
    echo "<br><br><center><input type='submit' name='submit'><br><br>";
    	
    
    	
    ?>
    
    <br><br>
    </form>
    
    <script>
    	$(function(){
    		$(".Slot").change(function(){
    			var SlotAmount = $(this).val();
    			var SlotAvail = $("#ASlot").val();
    			var totavailSlot = 0;
    
    			if($(this).attr("checked") == 'checked' ){
    				totavailSlot = parseInt(SlotAvail) - parseInt(SlotAmount);
    			}else{
    			    totavailSlot = parseInt(SlotAvail) + parseInt(SlotAmount);
    			}
    			if(totavailSlot < 0){
    				alert('No more Slots');
    				$(this).removeAttr("checked");
    			}else{
    				$("#ASlot").val(totavailSlot);
    			}
    		});
    	})
    </script>
    
    <script>
    	$(function(){
    		$(".units").change(function(){
    			var unitAmount = $(this).val();
    			var unitsAvail = $("#availUnits").val();
    			var totavailUnits = 0;
    
    			if($(this).attr("checked") == 'checked' ){
    				totavailUnits = parseInt(unitsAvail) - parseInt(unitAmount);
    			}else{
    			    totavailUnits = parseInt(unitsAvail) + parseInt(unitAmount);
    			}
    			if(totavailUnits < 0){
    				alert('Available Units Exceeded');
    				$(this).removeAttr("checked");
    			}else{
    				$("#availUnits").val(totavailUnits);
    			}
    		});
    	})
    </script>
    </body>
    </html>
    That is the subjectreservation tab. after selecting the subject that the user wishes to reserve.. they will click the button preview.. and this is what will happen.

    http://sphotos-f.ak.fbcdn.net/hphoto...48604492_n.jpg

    Code:
    <form method="POST" action=subjectreservation3.php>
    <?php
    	session_start();
    	$welcomeuser = $_SESSION['uname'];
    	?>
    
    <?php
    include 'connect.php';
    
    $query = ("SELECT * FROM stud_info WHERE StudentNumber = '$welcomeuser'");
    $result = mysql_query($query);
    while($row = mysql_fetch_array($result))
    	
    	 echo "<font size=5>" .$row['StudentNumber'] ."</font>" ."<br>". "<b>".$row ['Name'] . "<br>" . "</b>".$row['Address'] . "<br>" .$row['Department'] . "<br>" . "<i>".$row['CourseF'] ."</i>" ."<br>" . $row['Major'] ."<br>" .$row['Block']. $row['SchoolYear'] . "<br>" .$row['Semester'] ." Semester" . "<br>" ."<b><u>" ; 
    	 ?>
    
    <div class="CSSTableGenerator">
    <table border=3 align="center">
    <tr>
    <td></td>
    <td>Subject</td>
    <td>Day</td>
    <td>Time</td>
    <td>Descriptive Title</td>
    <td>Room</td>
    <td>Course</td>
    <td>Year</td>
    </tr>
    <center>
    <?PHP 
    INCLUDE ('CONNECT.PHP');
    $value=$_POST['yes'];	
    if (isset($_POST['submit'])){
    foreach ($value as $value2)
    {
    echo "<tr><td>" . $value2;
    echo "<br>";	
    }
    }
    ?>	
    </table>
    
    <center>
    <br>
    <form method="link" action="subjectreservation.php">
    <input type="submit" value="Clear">
    </form>
    <input type="submit" name="submit"></form>
    </body>
    </html>
    they can clear it so that they can select new subjects but if the subject is already finalized.. they can now click the submit button wherein they can print the copy of their schedule..

    it should be look like this..
    http://sphotos-h.ak.fbcdn.net/hphoto...04766735_n.jpg

    but this is what's happening.
    http://sphotos-d.ak.fbcdn.net/hphoto...62345798_n.jpg

    Code:
    <?php
    	session_start();
    	$welcomeuser = $_SESSION['uname'];
    	?>
    
    <?php
    include 'connect.php';
    
    $query = ("SELECT * FROM stud_info WHERE StudentNumber = '$welcomeuser'");
    $result = mysql_query($query);
    while($row = mysql_fetch_array($result))
    	
    	 echo "<font size=5>" .$row['StudentNumber'] ."</font>" ."<br>". "<b>".$row ['Name'] . "<br>" . "</b>".$row['Address'] . "<br>" .$row['Department'] . "<br>" . "<i>".$row['CourseF'] ."</i>" ."<br>" . $row['Major'] ."<br>" .$row['Block']. $row['SchoolYear'] . "<br>" .$row['Semester'] ." Semester" . "<br>" ."<b><u>" ; 
    	 ?>
    
    <div class="CSSTableGenerator">
    <table border=3 align="center">
    <tr>
    <td></td>
    <td>Subject</td>
    <td>Day</td>
    <td>Time</td>
    <td>Descriptive Title</td>
    <td>Room</td>
    <td>Course</td>
    <td>Year</td>
    </tr>
    <center>
    <?PHP 
    INCLUDE ('CONNECT.PHP');
    $value=$_POST['yes'];	
    if (isset($_POST['submit'])){
    if (isset($_POST['yes'])==""){
    echo "Please select subject!";
    }
    else{
    foreach ($value as $value2)
    {
    echo "<tr><td>" . $value2;
    	echo "<br>";
    	}
    }
    
    
    }
    
    ?>	
    </table>
    
    <center>
    <br>
    
    <b>NOTE:<BR></b>
    <u>YOU HAVE 10 DAYS TO ENROL THE SELECTED SUBJECT</u>
    <center>
    <br>
    <input type="button" value="Print" onclick="window.print();" />
    </body>
    </html>
    Last edited by ralph.m; Nov 28, 2012 at 17:23.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •