我正在做一个库存计划,我需要以下方面的帮助:我有一个表格,它通过从我的数据库中选择数据并将其显示在表格中来工作。我现在需要让用户能够从表单中删除错误/错误的记录(当然,你不想每次都必须进入数据库本身来删除记录,这会很愚蠢)
我的代码:
<div id="artikel-container">
<table class="table 1">
<thead>
<title>Inventory Grid.html</title>
<meta charset = "UTF-8" />
<style type = "text/css">
table, td, th {
border: 1px solid black;
}
</style>
</thead>
<tbody>
<?php
$con = mysqli_connect("localhost", "root", "admin", "inventarisdb");
// Check connection
if ( mysqli_connect_errno() ) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query( $con, "SELECT * FROM BCD" );
echo "<table border='0'>
<tr>
<th>Categorie</th>
<th>SerieNummer</th>
<th>MacAdress</th>
<th>ProductCode</th>
<th>Prijs</th>
<th>RekNummer</th>
<th>PaletNummer</th>
<th>Hoeveelheid</th>
<th>Aantekeningen/th>
</tr>";
while( $row = mysqli_fetch_array( $result ) ) {
echo "<tr>";
echo "<td>" . $row['Categorie'] . "</td>";
echo "<td>" . $row['SerieNummer'] . "</td>";
echo "<td>" . $row['MacAdress'] . "</td>";
echo "<td>" . $row['ProductCode'] . "</td>";
echo "<td>" . $row['Prijs'] . "</td>";
echo "<td>" . $row['RekNummer'] . "</td>";
echo "<td>" . $row['PaletNummer'] . "</td>";
echo "<td>" . $row['Hoeveelheid'] . "</td>";
echo "<td>" . $row['Aantekeningen'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?>
</article>
</fieldset>
</tbody>
此代码完美运行!
我想要实现的是使用复选框从该表中选择记录,并通过单击页面底部的删除按钮来删除它们,如下所示:
<Input type="submit" id="submit" name="submit" value="Verwijderen" />
或者至少有这个原则!
(这是我写的第二个应用程序,第一个是网页,我不知道如何研究这个。我一直在寻找不是我需要的问题和帖子:S 希望你能帮助我)