Forum Moderators: coopster
Basically, it goes like this:
[ ] User 1
[ ] User 2
[ ] User 3
[ Remove users ]
The top three parts are checkboxes that the user can check/uncheck (as you'd expect), the bottom is a button the user presses to thus remove them (I have a separate form for adding them that already works).
I would presume that the results of which boxes are checked will be returned as an array. What I need to then do is then count the number of variables in that array and run multiple queries (updates, deletes, etc.) for each.
Thanks in advance!
<inside your form>
<input type="checkbox" name="users[]" value="1">
<input type="checkbox" name="users[]" value="2">
<input type="checkbox" name="users[]" value="3">
<input type="checkbox" name="users[]" value="x">
<inside php action script>
$users = $_POST['users'];
foreach($users as $user){
//$user now contains 1, 2, 3, or x
//if any of them were checked they will show up in this loop
//this is where you will process this information and run your queries
}//print_r($_POST); //when you get lost
The value of each checkbox should be your user IDs to make this work. For the purpose of simplicity, I used static values.