gongpex Posted July 11, 2015 Share Posted July 11, 2015 Hello everyone, I have a code : index.php <html><head></head><body><form action="update.php" method="post"> <label>Name</label> <input type="text" name="test" /> <select name="activate"> <option value="on">ON</option> <option value="off">OFF</option> </select><button>Update</button></form></body></html> usually if we want to update we put this code : update.php <?php$test = $_POST['test'];$activate = $_POST['activate'];mysqli_query($connect,"update name_table set status='$activate' where name ='$test'")?> Q : how to set ajax so that user no need to press submit button, but only choose 'ON / OFF' on select option so the update script (on update.php) can be executed? please help me Thanks Link to comment Share on other sites More sharing options...
Ingolme Posted July 11, 2015 Share Posted July 11, 2015 AJAX involves Javascript. You should look at the AJAX tutorial at W3Schools. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now