having trouble with multiple update queries

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
   I am working an an application to enumerate users and permissions  
they have to read certain fax queues on a fax server. The problem I am  
having is that I can't figure out a way to let the admin grant  
permission to users to users in bulk. What I do is print out a table  
with checkboxes for each queue. I can name the checkboxes anything, but  
right now I an naming them with fax queue id, but I could just as easily  
name then like an array like "queueid[]". The problem is, how do I tell  
php that the checkbox and the $queue_id variables are to be processed  

echo "<td width=\"10%\" scope=\"col\"><input type=\"checkbox\"  
name=\"$queueid\" value=\"YES\" $checked></td>\n";
echo "    <td width=\"60%\" scope=\"col\">$queue_id</td>\n";
echo "    <td width=\"40%\" scope=\"col\">$queue_name</td>\n";
echo "  </tr>\n";
echo "</table>\n";

The admin would click the checkboxes of each queue the user will have  
access to. I can do this one queue at a time, but that's not very  
elegant when you have a lot of fax queues and a lot of users. What I  
want to do is: After clicking the submit button, all of the fax queues  
are updated with the new permissions for that user. It seems as though  
there is a simple way to do this, but I guess it's a little beyond me at  
this time. Can anyone offer any suggestions on how to get php to  
understand that for each checkbox in each table, I want to update the  
corresponding fax queue in that table with the new permissions??

Re: having trouble with multiple update queries

        $users = array( 1 => "Alice",
                        2 => "Bob",
                        3 => "Charlie",
                        4 => "Trudy");

        echo '<form method="GET">';
        foreach ($users as $id => $user) {
                echo '<p>';
                echo '<input type="checkbox" name="perm[]"
                echo $user;
                echo '</p>';
        echo '<input type="submit">';
        echo '</form>';

        if (isset($_GET['perm'])) {
                $perm = $_GET['perm'];
                foreach ($perm as $userid) {
                        echo '<br>'.$users[$userid].' is set';
        } else {
                echo '<br>None are set';


Site Timeline