ShoeLace1291 Posted June 10, 2007 Share Posted June 10, 2007 If I'm looping a database query and displaying the results, how do I delete the results where a checkbox next to it is checked? Quote Link to comment https://forums.phpfreaks.com/topic/54920-delete-database-result-with-checkbox/ Share on other sites More sharing options...
soycharliente Posted June 10, 2007 Share Posted June 10, 2007 Put the checkbox in a form, give it a name, check for it being selected in the $_POST array, then delete if it's checked. Something like... <?php if(isset($_POST["checkboxforusernamedcharlie"]) { $foo = $_POST["checkboxforusernamedcharlie"]; $query = "DELETE FROM table WHERE user='$foo'"; ?> That's how I'd go about it. Quote Link to comment https://forums.phpfreaks.com/topic/54920-delete-database-result-with-checkbox/#findComment-271620 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.