以下代码每行添加一个Accept / Decline按钮。但由于某种原因,拒绝按钮不会出现。我不知道什么是错的。已经卡住了一段时间了。帮助将不胜感激。谢谢!
<?php
$con=mysqli_connect("localhost","root","","rabco");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM service_request");
echo "<table border='1'>
<tr>
<th>Service ID</th>
<th>Service Type</th>
<th>Schuduled Date</th>
<th>Scheduled Time</th>
<th>Client Reference
<th>Client ID</th>
<th>Admin ID</th>
<th>Special Instructions</th>
<th>Status</th>
<th>Approve</th>
<th>Decline</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['Service_ID'] . "</td>";
echo "<td>" . $row['Service_type'] . "</td>";
echo "<td>" . $row['Sched_date'] . "</td>";
echo "<td>" . $row['Sched_time'] . "</td>";
echo "<td>" . $row['Client_reference'] . "</td>";
echo "<td>" . $row['Client_IDN'] . "</td>";
echo "<td>" . $row['Admin_IDN'] . "</td>";
echo "<td>" . $row['Special_instructions'] . "</td>";
echo "<td>" . $row['Request_status'] . "</td>";
echo "<td><a href='approve.php?Service_ID=".$row['Service_ID'].">Approve</a></td>";
echo "<td><a href='decline.php?Service_ID=".$row['Service_ID'].">Decline</a></td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?>
答案 0 :(得分:0)
这里有一个错过的结束语:
echo "<td><a href='approve.php?Service_ID=".$row['Service_ID'].">Approve</a></td>";
更改为:
echo "<td><a href='approve.php?Service_ID=".$row['Service_ID']."'>Approve</a></td>";
答案 1 :(得分:0)
您错过了href
属性的结束引号,这会产生格式错误的HTML输出。
您需要更改:
echo "<td><a href='approve.php?Service_ID=".$row['Service_ID'].">Approve</a></td>";
echo "<td><a href='decline.php?Service_ID=".$row['Service_ID'].">Decline</a></td>";
到
echo "<td><a href='approve.php?Service_ID=".$row['Service_ID']."'>Approve</a></td>";
echo "<td><a href='decline.php?Service_ID=".$row['Service_ID']."'>Decline</a></td>";