Reputation: 101
I am working on a project and I got a small problem.I want to display a request to an owner which is stored in a table in mySQL.The first entry is fine.But the second entry comes next to the first entry instead of below.So it seems like this Header Header Header Header value value value value 2ndvalue 2ndvalue 2ndvalue 2ndvalue. How can I fix this and put the 2nd values below the respective headers and value.Here is my code
<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>
Upvotes: 0
Views: 34
Reputation: 15847
try moving your tr
into the loop instead of outside of it. Also title
is not valid for how you are using it. It is meant for the title tag of the website in 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>
Upvotes: 2