law Posted January 30, 2008 Share Posted January 30, 2008 How can i make an onclick checkbox that inserts data into my database? all i want is for the checkbox upon being clicked to change the value of my picks column in my database between 1 and 0. 1 if the box is checked and 0 if it is not. Here is the query that selects the column i wish to edit. "SELECT paid FROM members WHERE id = "$id"" I literally know nothing about javascript so im looking for the exact code or some good explanation.. because if i have to edit the code myself there is a 50% chance i will screw it up! thanks guys! i appreciate your time Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted January 30, 2008 Share Posted January 30, 2008 Well first off your using the mysql; you need to be using UPDATE. Then you will have to add an onclick event to a checkbox that will submit your form variable values to you php/mysql. something like: <script language="javascript"> function addinfo() { document.msqlfs.submit(); } </script> I have been here:<br><br> <form name="msqlfs" action="myphpandmysqlpage.php" method="post"> <input type="checkbox" name="checkboxnamehere" value="0" onclick="addinfo()"> Never <input type="checkbox" name="checkboxnamehere" value="1" onclick="addinfo()"> Once </form> 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.