Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/474.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/292.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Q:PHP在单击对话框时更新_Javascript_Php_Jquery - Fatal编程技术网

Javascript Q:PHP在单击对话框时更新

Javascript Q:PHP在单击对话框时更新,javascript,php,jquery,Javascript,Php,Jquery,我无法将状态\u id从1(待定)更新为2(确认)。这是我想要的,每当我点击检查按钮(确认按钮),它就会显示窗口。如果单击“是”按钮,它将自动将数据库从1(待定)更新为2(确认状态)。遗憾的是,我的代码没有更新数据库 这是我的密码: <table class="table table-condensed tablehead table-sortable" id="table" style="width:100%; "> <tr> <thead

我无法将
状态\u id
从1(待定)更新为2(确认)。这是我想要的,每当我点击检查按钮(确认按钮),它就会显示窗口。如果单击“是”按钮,它将自动将数据库从1(待定)更新为2(确认状态)。遗憾的是,我的代码没有更新数据库

这是我的密码:

<table class="table table-condensed tablehead table-sortable" id="table" style="width:100%; ">
    <tr>
        <thead>
        <th style="text-wrap:normal">Transmittal #</th>
        <th>Transmittal Date</th>
        <th>Sender Name</th>
        <th>Department</th>
        <th>Invoice #</th>
        <th>Document Type</th>
        <th>Vendor Name</th>
        <th>Remark</th>
        <th>Action</th>
        </thead>
    </tr>

        <?php
            include('connection.php');

            $sql = "SELECT en.transid, en.transdate, CONCAT(userlist.lname, ', ', userlist.fname, ' ', userlist.mname) AS sender_name,
                    userlist.`department`, en.document_number, doctype.document_type, doctype.document_description, vendor.`vendor_name`, en.`remarks`, 
                    en.status_id, stat.status_name
                    FROM tbl_encode_transmittal en
                    LEFT JOIN tbl_vendor vendor ON vendor.`vendor_id` =  en.vendor_id
                    LEFT JOIN tbl_doctype doctype ON doctype.`doc_id` = en.doctype_id
                    LEFT JOIN tbl_userlist userlist ON userlist.userid = en.sender_id
                    LEFT JOIN tbl_userlist userlist1 ON userlist1.userid = en.`receiver_id`
                    LEFT JOIN tbl_status stat ON stat.status_id = en.status_id
                    WHERE userlist1.`userid` = '".$_SESSION['userid']."'";

            $rs = mysql_query($sql) or die(mysql_error());

            while($row = mysql_fetch_array($rs)){
                echo "<tr>";
                echo "<tbody id=\"myTable\">";
                echo "<td><h6>" . $row['transid'] . "</h6></td>";
                echo "<td><h6>" . $row['transdate'] . "</h6></td>";
                echo "<td><h6>" . $row['sender_name'] . "</h6></td>";
                echo "<td><h6>" . $row['department']. "</h6></td>";
                echo "<td><h6>" . $row['document_number'] . "</h6></td>";
                echo "<td><h6>" . $row['document_type'] . " " . $row['document_description'] . "</h5></td>";
                echo "<td width=\"50\"><h6>" . $row['vendor_name'] . "</h6></td>"; ?>
                <td style="text-align:center; padding-top:10;"><a href="#" class="remarksBtn"><i class="fa fa-info-circle fa-lg"></i></a></td>

                <div id="remarks-dialog" title="Remarks">
                    <?php echo $row['remarks']; ?>
                </div>

                <td>
                    <?php
                        if($row['status_id'] == 1){
                            echo "<button type=\"button\" class=\"btn btn-success\" ><i class=\"acknowledge fa fa-check-circle fa-lg\"></i></button>";
                            echo "<button type=\"button\" class=\"btn btn-danger\" ><i class=\"incomplete fa fa-times-circle fa-lg\"></i></button>";
                            echo "<button type=\"button\" class=\"btn btn-warning\" ><i class=\"onprocess fa fa-cogs fa-lg\"></i></button>";
                        }
                        else if($row['status_id'] == 2){
                            echo"<button type=\"button\" class=\"btn btn-success disabled\"><i class=\"fa fa-thumbs-o-up fa-lg\"> ".$row['status_name']."</i></button>";
                        }
                        else if($row['status_id'] == 3){
                            echo "<button type=\"button\" class=\"btn btn-warning disabled\"><i class=\"fa fa-cogs fa-lg\"> ".$row['status_name']."</i></button>";
                        }
                        else if($row['status_id'] == 4){
                            echo "<button type=\"button\" class=\"btn btn-success\" id=\"acknowledge-btn\"><i class=\"acknowledge fa fa-check-circle fa-lg\"></i></button>";
                            echo "<button type=\"button\" class=\"btn btn-warning\" id=\"onprocess-btn\"><i class=\"onprocess fa fa-cogs fa-lg\"></i></button>";
                        }
                    ?>
                </td>
            <?php } ?>
        </tbody>
    </tr>
</table>

传递#
传送日期
事件的发送者
部门
发票#
文件类型
厂商名称
评论
行动

您可以回显您的
$sql
变量吗?@roullie哪里可以回显我的$sql变量?在
$sql=“UPDATE
tbl\u encode\u传输`SET status\u id='2',其中transid='”$_会话['transid']。"'";`我已经回显了$sql变量,但它不起作用。如果是这种情况,则您的
$\u POST['submit']
为空
<!--////////////////////////////////////////////////////////////////////////////////////////////////////////////////////-->
<!--/////////                                Acknowledge Button Window Function                               ///////// -->
<!--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
<div id="window_acknowledge-btn">
    <div id="windowHeader">
        <span>
            Acknowledge Status
        </span>
    </div>
    <div id="windowContent">
        <form method="post" action="acknowledge_process.php">
            <center><h4>Do you want to acknowledge this transmittal?</h4>
                <button type="submit" class="btn btn-success" name="submit"><i class="fa fa-check-circle-o fa-lg"></i> YES</button>&nbsp;&nbsp;
                <button type="button" class="btn btn-danger" id="cancel-btn"><i class="fa fa-times-circle-o fa-lg"></i> NO</button>            
            </center>
        </form>
    </div>
</div>
$(document).ready(function(){

    <!--////////////////////////////////////////////////////////////////////////////////-->
    <!--/////////         Acknowledge Button jqxWindow Function                /////////-->
    <!--////////////////////////////////////////////////////////////////////////////////-->

    $('.acknowledge').click(function(){
        $('#window_acknowledge-btn').jqxWindow('open');
        $('#window_acknowledge-btn').jqxWindow('draggable', true);
        $('#window_acknowledge-btn').jqxWindow('resizable', false);
    });

    $('#window_acknowledge-btn').jqxWindow({
        autoOpen: false,
        position: {x: 300, y: 200},
        showCollapseButton: false,
        maxHeight: 700,
        maxWidth: 1000,
        minHeight: 10,
        minWidth: 10,
        height: 135,
        width: 440
    });

    <!--////////////////////////////////////////////////////////////////////////////////-->
    <!--/////////         Incomplete Button jqxWindow Function                   //////////-->
    <!--////////////////////////////////////////////////////////////////////////////////-->

    $('.incomplete').click(function(){
        $('#window_incomplete-btn').jqxWindow('open');
        $('#window_incomplete-btn').jqxWindow('draggable', true);
        $('#window_incomplete-btn').jqxWindow('resizable', false);
    });

    $('#window_incomplete-btn').jqxWindow({
        autoOpen: false,
        position: {x: 300, y: 200},
        showCollapseButton: false,
        maxHeight: 400,
        maxWidth: 700,
        minHeight: 10,
        minWidth: 10,
        height: 265,
        width: 350
    });

    <!--////////////////////////////////////////////////////////////////////////////////-->
    <!--/////////         On-Process Button jqxWindow Function                   //////////-->
    <!--////////////////////////////////////////////////////////////////////////////////-->

    $('.onprocess').click(function(){
        $('#window_onprocess-btn').jqxWindow('open');
        $('#window_onprocess-btn').jqxWindow('draggable', true);
        $('#window_onprocess-btn').jqxWindow('resizable', false);
    });

    $('#window_onprocess-btn').jqxWindow({
        autoOpen: false,
        position: {x: 300, y: 200},
        showCollapseButton: false,
        maxHeight: 400,
        maxWidth: 700,
        minHeight: 10,
        minWidth: 10,
        height: 130,
        width: 470
    });

    $('#cancel-btn').click(function(){
        $('#window_acknowledge-btn').hide(1000);
    });

    $('#cancel1-btn').click(function(){
        $('#window_incomplete-btn').hide(1000);
    });

    $('#cancel2-btn').click(function(){
        $('#window_onprocess-btn').hide(1000);
    });

    $('.remarksBtn').click(function(){
        $('#remark-dialog').dialog();
    });
});
<?php

    include('dbconnection_set.inc.php');
    include('dbconnection_create.inc.php');

    if(isset($_POST['submit'])){
        $sql = "UPDATE `tbl_encode_transmittal` SET status_id = '2' WHERE transid = '" . $_SESSION['transid']. "'";

        if($conn->query($sql) === TRUE){
            header('location: acknowledge_transmittal.php');
        }
        else{
            echo "Error: " . $sql . "<br>" . $conn->error;
        }
    }



?>