Mini Shell

Direktori : /home/rizant5/public_html_old/admin/
Upload File :
Current File : /home/rizant5/public_html_old/admin/test-papers-insert.php

<?php 
require_once("../config.php");
?>
<?php
  if(isset($_POST['course_id'])){
    // include 'data.php';
    $chapter = $_POST['chapter'];
    $subject = $_POST['subject'];
    $course_id = $_POST['course_id'];
    $year = $_POST['year'];
    $question = $_POST['question'];
    $a = $_POST['a'];
    $b = $_POST['b'];
    $c = $_POST['c'];
    $d = $_POST['d'];
    $answer = $_POST['answer'];
    $showhint = $_POST['showhint'];

    $conn->exec("insert into test_papers (chapter,subject,course_id,year,question,a,b,c,d,answer,showhint) values ('$chapter','$subject','$course_id','$year','$question','$a','$b','$c','$d','$answer','$showhint')");
    header("location:test-papers.php");
  }

require_once("function-file.php");

require_once("function-menu.php");

cookiecheck();
?>

<!DOCTYPE html>

<html>

  <head>

    <meta charset="utf-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <title>Test Papers</title>

    <!-- Tell the browser to be responsive to screen width -->

    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">

    <?php  cssfile();datatablecss();?>

    <style>.selected{color:red;}</style>

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
    <script type="text/javascript">
      /*$(document).ready(function(){
        $("#course").change(function(e){
            e.preventDefault();
            var cid = $('#course').val();
            $.post("dropdown.php",
            {
               course: cid,   
            },
            function(data,status){
              $('#subject').html(data);
              chapter_list_ajax();
            });
        });
      });*/
    </script>
    <script type="text/javascript">
      /*$(document).ready(function(){
        $("#subject").change(function(e){
          chapter_list_ajax();
        });
      });

      function chapter_list_ajax(){
        // e.preventDefault();
        var sid = $('#subject').val();
        $.post("dropdown.php",
        {
           subject: sid,   
        },
        function(data,status){
          $('#chapter').html(data);
        });
      }*/
    </script>

    <style type="text/css">
      .padd_top_20{ padding-top: 20px; }
    </style>

  </head>

<body class="hold-transition skin-blue layout-top-nav">

    <!-- Site wrapper -->

<div class="wrapper">

<?php headermenu();?>

      <!-- =============================================== -->

      <!-- Content Wrapper. Contains page content -->

<div class="content-wrapper">
  <div class="col-sm-12">
    <section class="content">
      <div class="box">
        <div class="box-header with-border">
          <h3 class="box-title">Test Papers</h3>
        </div>
        <div class="box-body">
          <form action="" method="post" class="form-horizontal">
            <div class="form-group">
              <div class="col-sm-12">
                <div class="col-sm-3">
                  <label>Select Your Grade and Medium</label>
                  <select name="course_id" id="course" class="form-control" required>
                    <?php 
                    $data=$conn->prepare("select * from courses");
                    $data->execute();$result=$data->fetchall();
                      foreach($result as $row){
                      echo"<option value='$row[course_id]'";echo">$row[course_name]</option>";
                    }?>
                  </select>
                </div>
                <div class="col-sm-3">
                  <label>Subject</label>
                  <!-- <select name="subject_id" id="subject" class="form-control" required>
                    <option value="">Select Subject Name</option>
                  </select> --><br/>
                  <input type="text" name="subject">
                </div>
                <div class="col-sm-3">
                  <label>Chapter</label>
                  <!-- <select name="chapter_id" id="chapter" class="form-control" required>
                    <option value="">Select Chapter Name</option>
                  </select> --><br/>
                  <input type="text" name="chapter">
                </div>
                <div class="col-sm-3">
                  <label>Select Year</label>
                  <select name="year" id="year" class="form-control" required>
                    <?php $current_year= date("Y");
                      $lower_year = 2010;
                      for ($current_year; $lower_year<=$current_year ; $current_year--){ 
                      echo "<option value='".$current_year."'>Year " .$current_year. "</option>";
                      }     
                    ?>
                  </select>      
                </div>
              </div>
            </div>
            <div class="form-group">
              <div class="col-sm-12 padd_top_20">
                <div class="col-sm-12">
                  <label for="question"> Question: </label>
                  <!-- <input type="text" id="question" name="question" value= "" size="100" required> -->
                  <textarea name="question" id="question" class="form-control editors" placeholder="Type Question" rows="20"></textarea>
                </div>
              </div>
            </div>
            <div class="form-group">
              <div class="col-sm-12 padd_top_20">
                <div class="col-sm-6">
                  <label for="a"> A: </label>
                  <!-- <input type="text" id="a" name="a" value= "" required> -->
                  <textarea name="a" id="a" class="form-control editors" placeholder="Type Option" rows="20"></textarea>
                </div>
                <div class="col-sm-6">
                  <label for="b"> B: </label>
                  <!-- <input type="text" id="b" name="b" value= "" required> -->
                  <textarea name="b" id="b" class="form-control editors" placeholder="Type Option" rows="20"></textarea>
                </div>
              </div>
              <div class="col-sm-12 padd_top_20">
                <div class="col-sm-6">
                  <label for="c"> C: </label>
                  <!-- <input type="text" id="c" name="c" value= "" required> -->
                  <textarea name="c" id="c" class="form-control editors" placeholder="Type Option" rows="20"></textarea>
                </div>
                <div class="col-sm-6">
                  <label for="d"> D: </label>
                  <!-- <input type="text" id="d" name="d" value= "" required> -->
                  <textarea name="d" id="d" class="form-control editors" placeholder="Type Option" rows="20"></textarea>
                </div>  
              </div>
            </div>
            <div class="form-group">  
              <div class="col-sm-12 padd_top_20">
                <div class="col-sm-12">
                  <label for="answer"> Answer: </label>
                  <!-- <input type="text" id="answer" name="answer" value= "" required> -->
                  <select name="answer">
                    <option value="A">A</option>
                    <option value="B">B</option>
                    <option value="C">C</option>
                    <option value="D">D</option>
                  </select>
                  <!-- <textarea name="answer" id="answer" class="form-control editors" placeholder="Type Option" rows="20"></textarea> -->
                </div>
              </div>
            </div>
            <div class="form-group">
              <div class="col-sm-12 padd_top_20">
                <div class="col-sm-12">
                  <label for="showhint"> Showhint: </label>
                  <!-- <input type="text" id="showhint" name="showhint" value= "" size="100" required> -->
                  <textarea name="showhint" id="showhint" class="form-control editors" placeholder="Type Option" rows="20"></textarea>
                </div>
              </div>
            </div>
            <div class="form-group">
              <div  class="col-sm-12" align="center">
                <button type="submit" name="save" class="btn btn-primary">Submit Question</button>
              </div>
            </div>
          </form>     
        </div><!-- /.box-body -->
      </div><!-- /.box -->
    </section><!-- /.content -->
  </div>
</div></div><!-- /.content-wrapper -->

<?php footer();?>

</div><!-- ./wrapper -->

<?php jsfile();datatablejs();?>
<script src="//cdn.ckeditor.com/4.5.8/full/ckeditor.js"></script>
<script>
$(function() {
  $('.editors').each(function(){
    CKEDITOR.replace( $(this).attr('id') );
  });
});
</script>

</body>

</html>


Zerion Mini Shell 1.0