Form in php is submitted using submit button. When button is pressed then POST or GET methods are used to send data to server.Question is that if we don’t have submit button in form then how data will be sent to server.Or if we have link or any other event through which we want to submit data. Answer is javascript submit function is used to send data to server. When event is occured then javascript function should be called and inside that function
Here is javascript function and php code to handle submit form
javascript code 
function my_function (){
    document.form.submit() 
}
html form code
<form name=”my_form” method=”POST”>
<input type=”text” name=”user” id=”user”>
<input type=”password” name=”pass” id=”pass” focusout =”return my_function()”>
</form>
php code to get data is here.
<?php
   $user = $_POST[‘user’];
   $password = $_POST[‘pass’];
?>

 

Leave a Reply

Your email address will not be published. Required fields are marked *