参考上面的标题,我想问你所有的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>";
}
}
}
?>