crash21 Posted September 2, 2006 Share Posted September 2, 2006 Hello,I have made a page in which I load a mysql query.The results from this query load in page and see some results.In this page I must allow or reject a site.The results are like this:ID Site URL Email1 something something.com something@something.com2 somewhere somewhere.com something@somewhere.comOk, now next to email I have one checkbox and at belwo of page two butons one Allow and one Reject.The problem is how to make it to connect checkboxes with button and all chackboxes which I click and after click allow, allow site and all sites which check reject, reject them.I haven't got an idea...I have done it but with another way which allow me to allow and reject one site every time (writhing the id in a textfield and press either allo or reject...) but this way is not very efficient...Can you please help me? Quote Link to comment Share on other sites More sharing options...
obsidian Posted September 3, 2006 Share Posted September 3, 2006 basically, the best way is to handle all your checkboxes as a big array. name them all the same with "[]" after them. for instance, you may have this at the end of each row:[code]<input type="checkbox" name="row[]" value="$rowID" />[/code]where $rowID is the id of the URL or email you are reviewing. then, when you check all the ones you want and submit the form, the $_POST['row'] variable then holds all of them as an array. you can loop through them all at that point and either accept or reject them. so, let's say you click "reject":[code]<?php// reject has been clicked$rows = $_POST['row'];foreach ($rows as $row) { // now you deal with each one individually and reject them: // reject $row;}?>[/code]hope this helps 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.