LanceT Posted February 11, 2007 Share Posted February 11, 2007 Basically, my forum script allows users to become buddies with other users. And on the buddy confirm page I want to create a list that has a checkbox next to it. If they check the box, and press a button to add, then those buddies will be added to the mysql database. To give you a comparison, I basically just want it to do what Myspace's buddy confirm page does. Along with the "Select All" box. I'm just not quite sure how to use checkboxes in a form or how to incorporate them into PHP. Any help? Here is a pic to illustrate in case you guys are confused. Quote Link to comment Share on other sites More sharing options...
trq Posted February 12, 2007 Share Posted February 12, 2007 Have you got any code? What part exactly are you stuck on? Quote Link to comment Share on other sites More sharing options...
LanceT Posted February 12, 2007 Author Share Posted February 12, 2007 No I haven't got any code yet. What I am stuck on is how to make it so that the form knows to insert all the ones that are checked. Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 12, 2007 Share Posted February 12, 2007 give each checkbox a name like id_1, id_2 <- those are their id numbers. Then loop through them on the processing. Quote Link to comment Share on other sites More sharing options...
LanceT Posted February 14, 2007 Author Share Posted February 14, 2007 I'm understanding it a little better, but is there something I can do to check if the box is checked and then only inserting it if the box is checked? Another thing, I need a button to submit and a button to delete all the checked ones as well, so how do I write that? Quote Link to comment Share on other sites More sharing options...
fert Posted February 14, 2007 Share Posted February 14, 2007 http://us2.php.net/manual/en/function.isset.php and the button to delete all the check ones is javascript Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted February 14, 2007 Share Posted February 14, 2007 This is basically the same thing: http://snippets.tzfiles.com/snippet.php?id=11 All you need to do is remove the if/else section, and put your mysql in its place. You will also have to change the html too. 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.