xyn Posted June 29, 2006 Share Posted June 29, 2006 Hi.I was wonering how to delete several items from a MYSQL Database using Check Box's. Say i had 1- messages. ID: 1,2,3,4,5,6,7,8,9 and 10. I wanted to delete id: 1,5,7. by ticking the box..How would I make this possible? Quote Link to comment Share on other sites More sharing options...
hvle Posted June 29, 2006 Share Posted June 29, 2006 make a list of check box with same name like this:<input type="checkbox" name="delete[]" value="$id">each check box has different value id.then after POST, if user check box 3,5,7, the $_POST['delete'] will be an array of value like this:$_POST['delete'][0] = 3;$_POST['delete'][1] = 5;$_POST['delete'][2] = 7;then simply retrieve these 3,5,7 and set up a query.something like this:"delete from table where id in (3,5,7)"; 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.