显示错误但已成功保存到数据库中

时间:2019-03-09 02:54:19

标签: php

我的Start.php

      <?php

      $aq1 = $_POST['aq1'];
      $aq2 = $_POST['aq2'];
      $aq3 = $_POST['aq3'];
      $aq4 = $_POST['aq4'];
      $aq5 = $_POST['aq5'];
      $bq1 = $_POST['bq1'];
      $bq2 = $_POST['bq2'];
      $bq3 = $_POST['bq3'];
      $bq4 = $_POST['bq4'];
      $bq5 = $_POST['bq5'];
      $comment = $_POST['comment'];

              include_once('evchk.php');
              ?>

then my evchk.php is

    <?php

    include('config.php');


    // SQL Query To Fetch Complete Isnformation Of User
    $connection = new mysqli("localhost", "root", "", "evalsys");
    $con = mysqli_connect("localhost", "root", "", "evalsys");
    $tchr= $connection->real_escape_string($_GET["tid"]);
    $sq = "SELECT * FROM teacher WHERE teacherid ='$tchr' ";
    $result = mysqli_query($con,$sq);
    $rows = mysqli_fetch_array($result);

    $name = $row['fullname'];
    $sec = $row['section'];
    $studid = $_SESSION['login'];
    $fn = $rows['fullname'];
    $sc = $rows['subjectcode'];
    $sn = $rows['subjectname'];
    date_default_timezone_set("Asia/Manila");
    $date = date('M d, Y');
        if (isset($_POST['send_btn'])){


    // Create connection

    $conn = mysqli_connect('localhost','root','','evalsys');

    // Check connection

    if (!$conn) {
          die("Connection failed: " . mysqli_connect_error());
    }

    $sql = "INSERT INTO evaluation (comment, aq1, aq2, aq3, aq4, aq5, bq1, 
       bq2, bq3, bq4, bq5, fullname, section, studentid, date, 
           facultyname, subjectcode, subjectname)         
VALUES('$comment','$aq1','$aq2','$aq3','$aq4','$aq5','$bq1','$bq2','$bq3','$bq4','$bq5','$name','$sec','$studid','$date','$fn','$sc','$sn')";  
            if (mysqli_query($conn, $sql)) {
                  echo " ";
                  header('location: evaluate.php');
            } else {
                   $mess ="Invalid!";
                    echo "<script type='text/javascript'>alert('$mess'); 
        </script>";
                  header('Refresh:.0; url=start.php');
                  die();
            }
            mysqli_close($conn);
                }
            ?>

错误是

  

注意:未定义的索引:第285行的C:\ xampp \ htdocs \ evalsys \ start.php中的aq1
  注意:第286行的C:\ xampp \ htdocs \ evalsys \ start.php中未定义的索引:aq2
  注意:第287行的C:\ xampp \ htdocs \ evalsys \ start.php中未定义的索引:aq3
  注意:第288行的C:\ xampp \ htdocs \ evalsys \ start.php中未定义的索引:aq4
  注意:第289行的C:\ xampp \ htdocs \ evalsys \ start.php中的未定义索引:aq5
  注意:未定义的索引:第290行的C:\ xampp \ htdocs \ evalsys \ start.php中的bq1
  注意:未定义的索引:第291行的C:\ xampp \ htdocs \ evalsys \ start.php中的bq2
  注意:未定义的索引:第292行的C:\ xampp \ htdocs \ evalsys \ start.php中的bq3
  注意:未定义的索引:第293行的C:\ xampp \ htdocs \ evalsys \ start.php中的bq4
  注意:未定义的索引:第294行的C:\ xampp \ htdocs \ evalsys \ start.php中的bq5
  警告:无法修改标头信息-第39行的C:\ xampp \ htdocs \ evalsys \ evchk.php中已经发送过的标头(输出从C:\ xampp \ htdocs \ evalsys \ start.php:151开始)

有人可以借此启发我吗?谢谢!

0 个答案:

没有答案