如何选中复选框以便将数据发送到下一页

时间:2017-03-27 04:02:15

标签: php html

参考上面的标题,我想问你所有的senpais。

这是我对此事的编码;

<?php

require ("config.php");
$link = mysqli_connect($h,$u,$p,$db)
   OR die(mysqli_error());

   $query = "select  BIL, HOTEL, TOTAL, address from HOTELS"
   OR DIE(mysql_error());
   $result = mysqli_query($link,$query);

   echo "<table border=2>";
   while ($row = mysqli_fetch_array($result))   { 

       //echo "<tr><td>".$row["BIL"]."</td>";
       echo "<tr><td>$row[HOTEL]</td>";
       //echo "<td>$row[TOTAL]</td>";
       echo "<td>$row[address]</td>";
       echo "<td><a href='edit.html?edit=$row[BIL]'>Edit</a></td>";
       echo "<td><a href='delete.php?del=$row[BIL] '>Delete</a></td>";
       echo "<td><input name='checkbox[]' type='checkbox' value='{$row['HOTEL'] }'></td></tr>" ;
   }
?>
</body>
</html>
<form action="hotel.html" method="get">
<input name="" type="submit" value="Add hotel" />
</form>
<form action="pilihan.php" method="get">
<input name="submit" type="submit" value="Submit" />
</form>

PHP

<?php
if (isset($_POST['submit    '])) {
    if (!empty($_POST['checkbox'])) {
        foreach ($_POST['checkbox'] as $selected) {
            echo $selected."</br>";
        }
    }
}
?>

enter image description here 每当我试图勾选多个框并点击提交时,下一页都没有产生任何数据。有什么提示吗?

0 个答案:

没有答案