我正在做一个项目,遇到了一个小问题。我想向所有者显示一个存储在mySQL表中的请求。第一个条目很好。但第二个条目位于第一个条目的旁边,而不是下方。看起来是这样的页眉页眉值值值值2值2值。如何修复此问题,并将第二个值放在相应的标头和值下面。这是我的代码
<table border='1' cellpadding='5'>"
<title>View Incoming Orders</title>
<tr> <th>Restaurant Name</th>
<th>Customer</th>
<th>Order Date</th>
<th>Details</th>
<th>Cost</th>
<th>is Processed</th>
<th> Finalize Order </th>
<th> Delete </th>
</tr>
<tr>
<?php
$length=count($restaurantNames);
for($c=0; $c<$length; $c++){
$custDate=$customers[$c]. "/".$orderDates[$c];
echo "<td> $restaurantNames[$c]</td>";
echo "<td> $customers[$c]</td>";
echo "<td> $orderDates[$c]</td>";
echo "<td> $detailss[$c]</td>";
echo "<td> $costs[$c]</td>";
echo "<td> $isProcesseds[$c]</td>";
echo "<td><input type='checkbox' name='check_list[]' value='$custDate' />Finalize Order </td>";
echo "<td><input type='checkbox' name='check_list2[]' value='$custDate' />Delete </td>";
}
?>
</tr>
<tr><input type="submit" id="update" name="update" value="Update"></input></tr>
</table>
尝试将tr
移动到循环中,而不是移动到循环之外。此外,title
对您使用它的方式无效。它适用于head
中网站的标题标签
<table border='1' cellpadding='5'>"
<title>View Incoming Orders</title>
<tr> <th>Restaurant Name</th>
<th>Customer</th>
<th>Order Date</th>
<th>Details</th>
<th>Cost</th>
<th>is Processed</th>
<th> Finalize Order </th>
<th> Delete </th>
</tr>
<?php
$length=count($restaurantNames);
for($c=0; $c<$length; $c++){
echo "<tr>";
$custDate=$customers[$c]. "/".$orderDates[$c];
echo "<td> $restaurantNames[$c]</td>";
echo "<td> $customers[$c]</td>";
echo "<td> $orderDates[$c]</td>";
echo "<td> $detailss[$c]</td>";
echo "<td> $costs[$c]</td>";
echo "<td> $isProcesseds[$c]</td>";
echo "<td><input type='checkbox' name='check_list[]' value='$custDate' />Finalize Order </td>";
echo "<td><input type='checkbox' name='check_list2[]' value='$custDate' />Delete </td>";
echo "</tr>";
}
?>
<tr><input type="submit" id="update" name="update" value="Update"></input></tr>
</table>