Php 如何改变';X';如果表格的每一行都以单独的HTML形式表示,且每个提交按钮都要更改,则单击一次表格的列值';X';价值

Php 如何改变';X';如果表格的每一行都以单独的HTML形式表示,且每个提交按钮都要更改,则单击一次表格的列值';X';价值,php,html,mysql,forms,Php,Html,Mysql,Forms,我有一个mysql employee表,表中的cols=(EmpID、ProjectCode、Date、StartTime、EndTime、NoOfHours、TaskPerformed、ModifiedDate、Status),Status由整数值1(已计费)或2(未计费)或3(已开票)或4(未开票)组成,此状态列值只能由管理员更改 所以,我的问题是,我在PHP脚本中将表的每一行值显示为不同的html表单,并带有状态值复选框,管理员在其中检查相关条目,即在读取employee表的行值时,特定条

我有一个mysql employee表,表中的cols=
(EmpID、ProjectCode、Date、StartTime、EndTime、NoOfHours、TaskPerformed、ModifiedDate、Status)
,Status由整数值1(已计费)或2(未计费)或3(已开票)或4(未开票)组成,此状态列值只能由管理员更改

所以,我的问题是,我在PHP脚本中将表的每一行值显示为不同的html表单,并带有状态值复选框,管理员在其中检查相关条目,即在读取employee表的行值时,特定条目应该是开账单的或未开发票的或未开发票的条目。但这里的问题来自于检查,我需要为每个表单发出post请求,这意味着我需要单击10个按钮,如果我在一个表中有10行按钮,我需要单个按钮来提交所有10个表单数据

请指示方向

下面是
admindashboardentry.php
中的if条件,当管理员对
EmpID、ProjectCode、StartDate、,EndDate
即,admin通过方法POST向这些变量提供
admindashboard.php
中HTML表单中的值,以从数据库中获取表行


if(isset($_POST['empidcheck']) and isset($_POST['projectcodecheck']) and isset($_POST['startdatecheck']) and isset($_POST['enddatecheck'])){

    $empid = $_POST['empid'];
    $projectcode = $_POST['projectcode'];
    $startdate = $_POST['startdate'];
    $enddate = $_POST['enddate'];

    //to make database connection
    include('connection.php');  

    echo "<p>Admin Entry Received: $empid, $projectcode, $startdate, $enddate</p>";

    //To Display Name and Employee ID above table Start

    $nameDisplaySql = "SELECT EmpID, Name FROM employee_data WHERE EmpID = '$empid'";

    $result = $conn->query($nameDisplaySql);                                            

    if($result->num_rows > 0){
        while($row = $result->fetch_assoc()){

            echo "<p>".$row["EmpID"]." - ".$row["Name"]."</p>";
            echo "<hr>";

        }
    }


    //To Display Name and Employee ID above table End

    $selectSql = "SELECT * FROM $empid WHERE EmpID = '$empid' AND ProjectCode = '$projectcode' AND Date BETWEEN '$startdate' AND '$enddate' ORDER BY Date DESC, ModifiedDate DESC";


    $result = mysqli_query($conn, $selectSql);


    $sumNoOfHours = 0.0;    

    displayTableHeading();                                                                                                                                                                          

    while($row = mysqli_fetch_array($result))
    {

        $sumNoOfHours = $sumNoOfHours + $row['NoOfHours'];

        displayTableRow($row);


    }

    tableEnding($sumNoOfHours);

    //form element to make the button below table to get the entry

    echo "<form action = 'admindashboardentry.php' method = 'post'>";
    echo "<input type ='hidden' name='empid' value= '$empid' >";
    echo "<input type ='hidden' name='projectcode' value= '$projectcode' >";
    echo "<input type ='hidden' name='startdate' value= '$startdate' >";
    echo "<input type ='hidden' name='enddate' value= '$enddate' >";
    echo "<input type='submit' name = 'allsetdownload' value = 'Download'>";
    echo "</form>";


}


//Webpage Table Heading

function displayTableHeading(){

    // echo "<div class='heading'>";
    echo "<b>";
    echo "<input type='text'   size='7' value = 'EmpID' readonly>";
    echo "<input type='text' style='margin-left:2px;' size='8' value = 'Project Code' readonly>";
    echo "<input type='text' style='margin-left:2px;' size='6' value = 'Date'  readonly>";
    echo "<input type='text' style='margin-left:2px;' size='7' value = 'Start Time' readonly>";
    echo "<input type='text' style='margin-left:2px;' size='7' value = 'End Time'  readonly>";
    echo "<input type='text' style='margin-left:2px;' size='8' value = 'No Of Hours'  readonly>";
    echo "<input type='text' style='margin-left:2px;' size='17' value = 'Task Performed'  readonly>";
    echo "<input type='text' style='margin-left:2px;' size='14' value = 'Modified Date' readonly>";
    echo "</b>";
    // echo "</div>";
}

//Webpage Table Row

function displayTableRow($row){


    $taskstr = $row['TaskPerformed'];
    $modifieddate = $row['ModifiedDate'];   




    echo "<form action='admindashboardentry.php' method = 'post'>";

    echo "<input type='text' style='margin-top:2px;' name='empid' size='8' value =".$row['EmpID']." readonly>";                                 
    echo "<input type='text'  style='margin-top:2px; margin-left:2px;' name='projectcode' size='8' value =".$row['ProjectCode']." readonly>";
    echo "<input type='text'  style='margin-top:2px; margin-left:2px;' name='date' size='8' value =".$row['Date']." readonly>";
    echo "<input type='text'  style='margin-top:2px; margin-left:2px;' name='stime' size='8' value =".$row['StartTime']." readonly>";
    echo "<input type='text'  style='margin-top:2px; margin-left:2px;' name='etime' size='8' value =".$row['EndTime']." readonly>";
    echo "<input type='text'  style='margin-top:2px; margin-left:2px;' name='hours' size='8' value =".$row['NoOfHours']." readonly>";
    echo "<input type='text'  style='margin-top:2px; margin-left:2px;' name='taskperformed' size='20' value = '$taskstr'>";
    echo "<input type='text'  style='margin-top:2px; margin-left:2px;' name='modifieddate' size='15' value = '$modifieddate' readonly>";

    echo "<span>&nbsp</span><input id='checkBox1' style='margin-top:2px; margin-left:2px;' type='checkbox' name='billed' > <span style='font-weight:bold;'>Billed</span> ";
    echo "<span>&nbsp</span><input id='checkBox2' style='margin-top:2px; margin-left:2px;' type='checkbox' name= 'notbilled'> <span style='font-weight:bold;'>Not Billed</span>";
    echo "<span>&nbsp</span><input id='checkBox3' style='margin-top:2px; margin-left:2px;' type='checkbox' name='invoiced'> <span style='font-weight:bold;'>Invoiced</span>";
    echo "<span>&nbsp</span><input id='checkBox4' style='margin-top:2px; margin-left:2px;' type='checkbox' name='uninvoiced'> <span style='font-weight:bold;'>Uninvoiced</span>";

    echo "<span>&nbsp</span><input type='submit' id='button' style='margin-top:2px; margin-left:2px; ' name = 'submit' style='margin-left:10px;'>";


    echo "</form>";                                                             


}