mercredi 20 mai 2015

POST multiple check box values

I have this code snippet on step1.php

echo "<select name=\"guest_passes_used\">";

for ($i=0; $i<=$family_info['Guest_Passes'];)
{
    echo "<option value=\"{$i}\">{$i}</option>"; 
    $i++;
}

echo "</select><br /><br />";

And it creates a list of names and a checkbox next to each name like
[ ] Ray
[ ] Joe
[ ] Chris
[ ] Sam

Then on the step2.php page I want to have an insert query for every box that was checked.

i.e. if someone was to click the box next to Ray and Sam then queries would run that would put 2 rows into the table with their names and a timestamp (i made a timestamp column for that purpose).

Since I don't know the number of names (varies obviously) and I don't know how many of those will be checked the psuedo in my mind would be

for each box if checked update query

But I'm unsure how to execute. Thoughts? Thanks!




Aucun commentaire:

Enregistrer un commentaire