在PHP中使用POST或GET而不使用JS循环时,从更多输入标记发布数据

在PHP中使用POST或GET而不使用JS循环时,从更多输入标记发布数据,php,html,Php,Html,我正在尝试更新HTMl表中任何一行的付款价格和付款日期。 我使用此表查看必须付款的发票,并且我可以选择只支付部分价格。用户可以在输入字段中写入任何价格,还可以选择支付价格的日期。然后在用户点击提交按钮后,我想用这些新数据更新我的数据库。 但我传递这些数据有问题。 我真的不知道我是否可以使用GET方法来处理这个问题,还是只使用带有表单的POST方法 $AktualDate = date('Y-m-d'); $sqli = "SELECT * FROM invoice WHERE Price !=

我正在尝试更新HTMl表中任何一行的付款价格和付款日期。 我使用此表查看必须付款的发票,并且我可以选择只支付部分价格。用户可以在输入字段中写入任何价格,还可以选择支付价格的日期。然后在用户点击提交按钮后,我想用这些新数据更新我的数据库。 但我传递这些数据有问题。 我真的不知道我是否可以使用GET方法来处理这个问题,还是只使用带有表单的POST方法

$AktualDate = date('Y-m-d');

$sqli = "SELECT * FROM invoice WHERE Price != PayedPrice";                  
     $results = mysqli_query($conn, $sqli);
     if(mysqli_num_rows($results) > 0){ 

        echo"
        <table>
        <tr>
            <th>ID</th>
            <th>Firm</th>
            <th>Price</th>          
            <th>Payed Price</th>
            <th>Payed Date</th>
        </tr>               
            ";

        while($rows=mysqli_fetch_array($results)){

            $ID = $rows['ID'];
            $Firm = $rows['Firm'];
            $Price = $rows['Price'];
            $PayedPrice = $rows['PayedPrice '];
            $PayedDate = $rows['PayedDate '];

            echo"
            <tr>
            <form>";?><form action="payed.php" method="GET">
                <?php echo"
                <td>$ID</td>
                <td>$Firm</td>
                <td>$Price</td>
                <td><input type='text' name='PayedPrice ' value=".$PayedPrice ."></td>
                <td><input type='date' name='PayedDate ' value=".$AktualDate."></td>
                <td><button type='submit' name='pay'>PAY</button></td>          
            </form>
            </tr>

            ";
        }?>
        </table>
现在,当我点击按钮时,我的url中只得到了一些“奇怪”的更新,添加了这个?PayedPrice=4545&PayedDAte=2019-04-07&pay= 但问题是整个页面并没有重新加载,我看到我并没有将这些数据传递到下一个php文件。 有没有不使用JS、JQuery等的解决方案

thx请试试这个

<?php
$AktualDate = date('Y-m-d');
$sqli = "SELECT * FROM invoice WHERE Price != PayedPrice";                  
$results = mysqli_query($conn, $sqli);
if(mysqli_num_rows($results) > 0){ 
    echo"
    <table>
        <tr>
            <th>ID</th>
            <th>Firm</th>
            <th>Price</th>          
            <th>Payed Price</th>
            <th>Payed Date</th>
        </tr>               
    ";
    while($rows=mysqli_fetch_array($results)){
        $ID = $rows['ID'];
        $Firm = $rows['Firm'];
        $Price = $rows['Price'];
        $PayedPrice = $rows['PayedPrice '];
        $PayedDate = $rows['PayedDate '];
        echo"
        <tr>";
    ?>
        <form action="payed.php" method="GET">
        <?php echo"
            <td>" . $ID . "</td>
            <td>" . $Firm . "</td>
            <td>" . $Price . "</td>
            <td><input type='text' name='PayedPrice ' value=" . $PayedPrice . "></td>
            <td><input type='date' name='PayedDate ' value=" . $AktualDate . "></td>
            <td><button type='submit' name='pay'>PAY</button></td>
        </form>
    </tr>
    ";
    }
}
?>
</table>


您好,我在第25行的/var/www…./payed.php中收到了这个错误通知:未定义索引:ID。这意味着我没有传递ID值?对的我已经在“$ID”上方添加了一行代码。看起来是这样的:但我真的不知道这是否是一个好的解决方案。。。
<?php
$AktualDate = date('Y-m-d');
$sqli = "SELECT * FROM invoice WHERE Price != PayedPrice";                  
$results = mysqli_query($conn, $sqli);
if(mysqli_num_rows($results) > 0){ 
    echo"
    <table>
        <tr>
            <th>ID</th>
            <th>Firm</th>
            <th>Price</th>          
            <th>Payed Price</th>
            <th>Payed Date</th>
        </tr>               
    ";
    while($rows=mysqli_fetch_array($results)){
        $ID = $rows['ID'];
        $Firm = $rows['Firm'];
        $Price = $rows['Price'];
        $PayedPrice = $rows['PayedPrice '];
        $PayedDate = $rows['PayedDate '];
        echo"
        <tr>";
    ?>
        <form action="payed.php" method="GET">
        <?php echo"
            <td>" . $ID . "</td>
            <td>" . $Firm . "</td>
            <td>" . $Price . "</td>
            <td><input type='text' name='PayedPrice ' value=" . $PayedPrice . "></td>
            <td><input type='date' name='PayedDate ' value=" . $AktualDate . "></td>
            <td><button type='submit' name='pay'>PAY</button></td>
        </form>
    </tr>
    ";
    }
}
?>
</table>