Icedz Posted March 25, 2008 Share Posted March 25, 2008 I'm putting together a site where users can upload pictures. Each picture that gets uploaded is going to be verified by an admin. The pictures will be uploaded, but will have a flag of "not_activated" in a database. Let's say one day I get 100 pictures uploaded. How can I approve multiple at one time? For example, have a page come up with x at a time (I can do that), with either a check box or radio buttons approving or not approving the pics. Thanks! Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted March 25, 2008 Share Posted March 25, 2008 Name each checkbox something like "approve[]" and make the value the Images ID from the DB. EX. <input type="checkbox" name="approve[]" value="{$row['images_ID']}"> Then at the top of the script put this code: <?php if (isset($_POST['your_submit_button'])){ if (!empty($_POST['approve'])){ foreach ($_POST['approve'] as $imageID){ $imageID = (int)$imageID; $query = mysql_query("UPDATE image_table SET approved='yes' WHERE imageID=$imageID")or die(mysql_error()); } } echo "Images Approved"; } ?> Obviously change the queries to match your database. Quote Link to comment Share on other sites More sharing options...
Icedz Posted March 25, 2008 Author Share Posted March 25, 2008 w00t! thanks! I was on the right track. That makes me feel good at least Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.