I have encountered a brick wall trying to use checkboxes. I am attempting to create a small form where I can record if a customer's item has been sent. The way I intend it to work is that the name and ID of the customer (stored in the 'customer' table) are retrieved through a query and displayed in two columns. In the third column is a checkbox beside the name and ID of each customer which, when ticked, sends a value to a second table called 'sentorders' for that particular person. As I am just trying to understand the basics of this for now, a list of all customers will be shown for the time being. The default value of the checkbox needs to be 'No' and if the checkbox is ticked the value should become 'Yes'. When a checkbox is ticked, the customer name, ID and current date are sent to the 'sentorders' table. Only if the box is ticked will the details be stored in the table.
The problem I having is how do I set up the checkbox to work as described above. I have had a look at other questions online, but don't understand how it works. Any help would be appreciated. My current code is as follows.
<?php
$query = mysqli_query ($connect, "SELECT name, id FROM customer");
// Create Table
echo '<table align="left">
<tr>
<td align="left"><b>Name</b></td>
<td align="left"><b>ID</b></td>
<td align="left"><b>Order Sent</b></td>
</tr>';
// Show Name/ID
while ($row = mysqli_fetch_array($query)) {
echo '<tr><form action="order_sent.php" method="post"><td align="left">
<td align="left">' . $row['name'] . '</a></td>
<td align="left">' . $row['id'] . '</td>
<input type="checkbox" name="order[];" value=''></tr>';
}
echo '</table><p align="left"><input type="submit" name="enter" value="Update"/><input type="hidden" name="enter" value="TRUE" /></form>';
}
?>