I have a table that I am echoing out and now I added a check box to the end of it.
I would like when that box is checked. It can be checked on multiple items and then the save button is clicked. It would go to the post page and set complete in the database to "Yes" for all the IDs that were checked.
Problem is I do not understand how the checkbox will know which ID
is which once it goes to the post page.
<?php
$conduct = $_SESSION['username'];
$query = mysqli_query($con, "SELECT * FROM newworders WHERE train = 'Yes' AND conductor = '$conduct' AND complete = ' '");
echo "<table id='tb' border='1'>
<tr class='head'>
<th>First Name</th>
<th>Last Name</th>
</tr>";
while($row = mysqli_fetch_array($query)) {
echo "<tr>";
echo "<td>" . '<a href="orderpage.php?uid=' . $row['ID'] . '">' . $row['first'] . '</a><br />' . "</td>";
echo "<td>" . '<a href="orderpage.php?uid=' . $row['ID'] . '">' . $row['last'] . '</a><br />' . "</td>";
echo "<td>"."<input type='checkbox' value='Yes' name='complete'" . "</br>". "</td>";
}
<div class='new'>
<form action="savepending.php" method='POST'>
<input type='submit' name ='save'/>
</form>
</div>
Then the post page.
<?php
if(isset($_POST['save']))
{
$query = mysqli_query($con, "UPDATE newworders SET complete = 'Yes' WHERE ")
}
?>
I have no idea what to put in the WHERE
part. I just dont understand how it will tell which ID
is which.