Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include "dbFunctions.php";
- IF (isset($_SESSION['parent_nric'])){
- $theNRIC = $_SESSION['parent_nric'];
- $redirectQuery = "SELECT * "
- . "FROM student, parent, student_cca "
- . "WHERE student.student_id = student_cca.student_id "
- . "AND student.parent_nric = parent.parent_nric "
- . "AND parent.parent_nric ='".$theNRIC."'";
- $redirectResult = mysqli_query($link, $redirectQuery) or die(mysql_error());
- $totalrows = mysqli_num_rows($redirectResult);
- if ($totalrows > 0)
- { // has results
- header("Location: parent_view_cca.php");
- exit(0);
- }
- else
- { // no result
- echo "<h4>Welcome to Maintain CCA!</h4>";
- }
- $query = "SELECT student.student_id, cca.cca_name, cca_category.category_name FROM choices, student, parent, cca, cca_category WHERE student.student_id = choices.student_id and choices.cca_id=cca.cca_id AND cca.category_id=cca_category.category_id and student.parent_nric = parent.parent_nric and parent.parent_nric='".$theNRIC."'";
- $result = mysqli_query($link, $query);
- $numrow = mysqli_num_rows($result);
- if ($numrow > 0)
- { // has results
- echo "<h5>Please check your choices accordingly.</h5>";
- }
- else
- { // no result
- //echo "<h4>You have not chosen a CCA! <a href='parent_add_submit_cca_choice.php'>Click here to do so!</a>.</h4>";
- header("Location: parent_add_submit_cca_choice.php");
- exit(0);
- }
- $row = mysqli_fetch_array($result);
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta name="description" content="">
- <meta name="author" content="">
- <title>CCA Registration System</title>
- <!-- Bootstrap Core CSS -->
- <link href="css/bootstrap.min.css" rel="stylesheet">
- <!-- Custom CSS -->
- <link href="css/shop-homepage.css" rel="stylesheet">
- <script language="javascript" type="text/javascript">
- function showCCADropDown1() {
- var str1 = document.getElementById("category1").value;
- if (window.XMLHttpRequest) {
- // code for IE7+, Firefox, Chrome, Opera, Safari
- xmlhttp = new XMLHttpRequest();
- } else {
- // code for IE6, IE5
- xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
- }
- xmlhttp.onreadystatechange = function () {
- if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
- document.getElementById("ajaxDiv1").innerHTML = xmlhttp.responseText;
- }
- };
- xmlhttp.open("GET", "getCCADropDown.php?cat_id=" + str1, true);
- xmlhttp.send();
- }
- function showCCADropDown2() {
- var str2 = document.getElementById("category2").value;
- if (window.XMLHttpRequest) {
- // code for IE7+, Firefox, Chrome, Opera, Safari
- xmlhttp = new XMLHttpRequest();
- } else {
- // code for IE6, IE5
- xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
- }
- xmlhttp.onreadystatechange = function () {
- if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
- document.getElementById("ajaxDiv2").innerHTML = xmlhttp.responseText;
- }
- };
- xmlhttp.open("GET", "getCCADropDown.php?cat_id=" + str2, true);
- xmlhttp.send();
- }
- </script>
- <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
- <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
- <!--[if lt IE 9]>
- <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
- <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
- <![endif]-->
- </head>
- <body>
- <!-- Navigation -->
- <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
- <div class="container">
- <!-- Brand and toggle get grouped for better mobile display -->
- <div class="navbar-header">
- <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
- <span class="sr-only">Toggle navigation</span>
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- </button>
- <a class="navbar-brand" href="#">CCA Registration System</a>
- </div>
- <!-- Collect the nav links, forms, and other content for toggling -->
- <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
- <ul class="nav navbar-nav">
- <li>
- <a href="#">Browse CCA</a>
- </li>
- <li>
- <a href="parent_cca_choice.php">CCA Choices</a>
- </li>
- <li>
- <a href="parent_edit_maintain_personal_information.php">Maintain Personal Information</a>
- </li>
- <li>
- <a href="parent_maintain_student_information.php">Maintain Student Information</a>
- </li>
- <li>
- <a href="logout.php">Logout</a>
- </li>
- </ul>
- </div>
- <!-- /.navbar-collapse -->
- </div><!-- /.container -->
- </nav>
- <center>
- <!-- Page Content -->
- <h1><u>Maintain CCA</u></h1>
- <br>
- <form method="post" action="do_parent_submit_cca_choice.php">
- <div style="width:350px;">
- <h4><label for="choice">1st Choice:</label></h4>
- <br>
- <select class="form-control" id="choice" name="choice">
- <option value ="<?php echo $row['category_id']; ?>">
- <?php echo $row['category_name']; ?>
- </option>
- </select>
- <br>
- <select class="form-control" id="choice" name="choice">
- <option value ="<?php echo $row['cca_id']; ?>">
- <?php echo $row['cca_name']; ?>
- </option>
- </select>
- <br></br>
- <input type="hidden" name="student_id" value="<?php echo $row['student_id'] ?>" />
- <a href="do_parent_delete_cca_choice.php"<button type="button" class="btn btn-danger">Delete CCA Choices</button></a>
- <a href="do_parent_submit_cca_choice.php"<button type="button" class="btn btn-info">Submit CCA Choices</button></a>
- <br><br>
- <button id = 'hideshow' value='hide/show' type="button" class="btn btn-warning">Add CCA Choices</button>
- <br></br>
- <div id='content'>
- <div style="width:350px;">
- <label for="category1">2nd Choice:</label>
- <select class="form-control" id="category1" name="category1" onchange="showCCADropDown1()">
- <option value="0">All Category</option>
- <?php
- while ($categoryRow1 = mysqli_fetch_assoc($categoryResult1)) {
- ?>
- <option value ="<?php echo $categoryRow1['category_id']; ?>">
- <?php echo $categoryRow1['category_name']; ?>
- </option>
- <?php
- }
- ?>
- </select>
- <div id='ajaxDiv1'></div>
- </div>
- <br>
- <div class="row">
- <div style="width:350px;">
- <label for="category2">3rd Choice:</label>
- <select class="form-control" id="category2" name="category2" onchange="showCCADropDown2()">
- <option value="0">All Category</option>
- <?php
- while ($categoryRow2 = mysqli_fetch_assoc($categoryResult2)) {
- ?>
- <option value ="<?php echo $categoryRow2['category_id']; ?>">
- <?php echo $categoryRow2['category_name']; ?>
- </option>
- <?php
- }
- ?>
- </select>
- <div id='ajaxDiv2'></div>
- </div>
- </div>
- </div>
- </div>
- </form>
- <?php }else {
- echo"you are unable to view this page";
- }
- ?>
- <br>
- </centre>
- <!-- Footer -->
- <footer>
- <div class="row">
- <div class="col-lg-12">
- <p>Copyright © 4 Aces</p>
- </div>
- </div>
- </footer>
- </div>
- <!-- /.container -->
- <!-- jQuery -->
- <script src="js/jquery.js"></script>
- <script>
- jQuery(document).ready(function(){
- jQuery('#hideshow').live('click', function(event) {
- jQuery('#content').toggle('show');
- });
- });
- </script>
- <!-- Bootstrap Core JavaScript -->
- <script src="js/bootstrap.min.js"></script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement