vinpkl Posted June 20, 2009 Share Posted June 20, 2009 hi all i want to auto submit the form and run the update query on just selecting the checkbox. I m able to run the update query on selecting checkbox and clicking update button. But how can i auto submit form and run update query on just selecting of checkbox and without clicking the update button. i m using the below code but nothing happens <form action="http://localhost/gads/catalogue.php" method="post" name="product" id="product"> <input type="checkbox" name="rural" id="rural" onchange="product.submit();" </form> if(isset($_REQUEST['rural'])) { update query } vineet Link to comment https://forums.phpfreaks.com/topic/162996-auto-submit-form-on-selecting-checkbox/ Share on other sites More sharing options...
Ken2k7 Posted June 20, 2009 Share Posted June 20, 2009 Try: <form action="http://localhost/gads/catalogue.php" method="post" name="product" id="product"> <input type="checkbox" name="rural" id="rural" onclick="document.forms.product.submit();" /> </form> Link to comment https://forums.phpfreaks.com/topic/162996-auto-submit-form-on-selecting-checkbox/#findComment-860051 Share on other sites More sharing options...
vinpkl Posted June 20, 2009 Author Share Posted June 20, 2009 Try: <form action="http://localhost/gads/catalogue.php" method="post" name="product" id="product"> <input type="checkbox" name="rural" id="rural" onclick="document.forms.product.submit();" /> </form> hi Ken2k7 thanks for the reply. it works great as needed. but the checkbox doesnt remain selected. can checkbox remain selected until user uncheck it. or will it be done server side. vineet Link to comment https://forums.phpfreaks.com/topic/162996-auto-submit-form-on-selecting-checkbox/#findComment-860058 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.