我做了一个while循环,它显示Ploegen
数据库中的所有用户我让它输出假设隐藏的文本,但我正在测试它。无论如何,它只需要更新 1 行,它在页面上显示的文本和 id 是正确的,但更新总是 ID 1,而我更改了很多选项值并且 valueid(名称)总是相同的。
我不知道如何完成我尝试过的这项工作,希望你能解释一下。
我不需要反馈,因为代码不好,只需要帮助解决问题。
<div class="content-module-main">
<?php if(isset($_POST['submit'])){
$idtje = $_POST['valueid'];
$valueid = $_POST['ploeg'];
$idtje = mysqli_real_escape_string($connect, $idtje);
$valueid = mysqli_real_escape_string($connect, $valueid);
//$go = "UPDATE `ploegen` SET `ploeg`='$id' where `id`='$valueid'";
//$go2 = mysqli_query($connect, $go);
echo "<di" . "v class=\"confirmation-box round\">Ploegentest var_dump($valueid); var_dump($idtje);</div>";
}
?>
<table>
<thead>
<tr>
<th>Ploeg</th>
<th>Naam</th>
<th>Tel</th>
<th>Gas of Elektra</th>
<th>Wijzig</th>
</tr>
</thead>
<tbody>
<tr>
<form method="post" action="home_ploegen_b.php">
<?php
$query = "SELECT naam, telefoonnummer, id, ploeg, gasofelektra FROM ploegen ORDER by naam DESC LIMIT 100";
if ($result = mysqli_query($connect, $query)) {
while ($get = mysqli_fetch_assoc($result)) {
echo"<tr><td><center>" . $get['ploeg'] . "</center></td>";
echo"<td>" . $get['naam'] . "</td>";
echo"<td>" . $get['telefoonnummer'] . "</td>";
echo"<td>" . $get['gasofelektra'] . "</td>";
echo"<td><center><input type=\"text\" name=\"valueid\" value=\"" . $get['naam'] . "\" /><select name=\"ploeg\">
<option value=\"1\">Ploeg 1</option>
<option value=\"2\">Ploeg 2</option>
<option value=\"3\">Ploeg 3</option>
<option value=\"4\">Ploeg 4</option>
<option value=\"5\">Ploeg 5</option>
<option value=\"6\">Ploeg 6</option>
<option value=\"7\">Ploeg 7</option>
<option value=\"8\">Ploeg 8</option>
<option value=\"9\">Ploeg 9</option>
<option value=\"10\">Ploeg 10</option>
</select><input type=\"submit\" name=\"submit\" value=\"UPDATE\"></center></td></tr>";
}
}
?> </td></form>