单击按钮

时间:2018-02-18 11:21:16

标签: php html mysql database phpmyadmin

因此,我建立了一个支持票务系统,员工可以在系统中发送问题/问题。这就是它的样子:

enter image description here

我想要发生的是status从" New"到"打开"每当我点击“接受”按钮。目前我所做的并不起作用。

这是我的表格:



<td>
  <form method="post" action="update1.php">
    <input type="hidden" name="ticketno" value="<?php echo $row_message['ticketno']; ?>" />
    <input type="submit" name="accept" value="Accept"></input>
  </form>
</td>
&#13;
&#13;
&#13;

这是我的update1.php:

<?php

    session_start();
    ob_start();

    //Include the database connection file
    include "database_connection.php"; 
    $check_user_details = mysql_query("select * from `employee` where `username` = '".mysql_real_escape_string($_SESSION["VALID_USER_ID"])."'");
    //Validate created session
    if(mysql_num_rows($check_user_details) < 1)
    {
        session_unset();
        session_destroy();
        header("location: login.php");
        exit;
    }

    //Get all the logged in user information from the database users table
    $get_user_details = mysql_fetch_array($check_user_details);

    if(isset($_POST['accept']))
    {
        $msg = "Approved";
        $assignee = $get_user_details['fullname'];
        $status = $_POST['Open'];
    }

    $ticketno=$_POST['ticketno'];
    $con = mysqli_connect('localhost', 'root', '');
    mysqli_select_db($con, 'companydb');

    $sql = "UPDATE tickets SET 
                assignee = '$assignee' 
            WHERE ticketno = '$ticketno'";

    if(mysqli_query($con, $sql))
        header("refresh:1; url=tickets.php?msg=$msg");
    else
        var_dump(mysqli_error($con));

?>

PS:我知道mysql已被弃用。我最终会改变它,现在我需要弄明白:)

0 个答案:

没有答案