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 Link to comment https://forums.phpfreaks.com/topic/88573-onclick-checkbox-that-inserts-data-into-a-database/ 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> Link to comment https://forums.phpfreaks.com/topic/88573-onclick-checkbox-that-inserts-data-into-a-database/#findComment-453909 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.