Submit Form Using Ajax,PHP and Javascript

Today you will be able to submit form without refresh the page.

It can be only possible with AJAX(Asynchronous JavaScript and XML). Yes ! you can submit any html form without getting refresh the page.
Just follow our post or download it to use.
For this you must have a database in MY-SQL . Here, we have database named “ajax” which consists of table named “registration” with 5 fields.
you can set according your requirement this is just for demo.

Table structure :-

CREATE DATABASE ajax;
CREATE TABLE registration(
id INT( 10 ) NOT NULL AUTO_INCREMENT ,
name VARCHAR( 255 ) NOT NULL ,
email VARCHAR( 255 ) NOT NULL ,
password VARCHAR( 255 ) NOT NULL ,
contact VARCHAR( 255 ) NOT NULL ,
PRIMARY KEY ( id )
)

First of all we create a page name registration.php.

<html>
<head>
<title>Divson.in</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<link href="style.css" rel="stylesheet">
<script src="script.js"></script>
</head>
<body>
<div id="mainform">
<div class="innerdiv">
<h2>Submit Form Using AJAX,PHP and javascript</h2>
<!-- Required Div Starts Here -->
<form id="form" name="form">
<h3>Fill Your Information!</h3>
<div>
<label>Name :</label>
<input id="name" type="text">
<label>Email :</label>
<input id="email" type="text">
<label>Password :</label>
<input id="password" type="password">
<label>Contact No :</label>
<input id="contact" type="text">
<input id="submit" onclick="myFunction()" type="button" value="Submit">
</div>
</form>
<div id="clear"></div>
</div>
<div id="clear"></div>
</div>
</body>
</html>


Author: Gautam Jha
I am Gautam Jha from New Delhi, India. I love to write code and blogs, traveling, Video games, sometimes study as well.

Leave a Reply

Hey there!

Sign in

Forgot password?
Close
of

Processing files…