I'm creating a table like this:
$sqlab = "select * from meal_orders";
$sqlab .= " where meal_ID like '$choice'";
$res = mysqli_query($db, $sqlab);
$num = mysqli_num_rows($res);
echo "<table>";
echo "<tr><td>ID</td><td>Date</td><td>Customer</td><td>Meal</td><td>State</td></tr>";
$num = 1;
while ($dsatz = mysqli_fetch_assoc($res))
{
echo "<tr>";
echo "<td>" . $dsatz["ID"] . "</td>";
echo "<td>" . $dsatz["Date"] . "</td>";
echo "<td>" . $dsatz["Customer"] . "</td>";
echo "<td>" . $dsatz["Meal"] . "</td>";
echo "<td>" . $dsatz["State"] . "</td>";
echo "</tr>";
$i++;
}
The result shows a list of meal-orders for the before chosen meal.
Now I want to create a form out of this. The User should be able to tick a Checkbox for each record that he wants (just one, just some, or all) .
After selecting, I want to run an update-script, that only updates the selected records. So that State for the chosen records changes from new to done, i.e.
What's the best way to do this? I'm especially asking for the update-Statement, cause so far, I've always just updated one record at a time.
Aucun commentaire:
Enregistrer un commentaire