Tags

Universal Coder

This is a Registration.php file

In This file Simple create registration form and submit by using AJAX

<!DOCTYPE html>
<html>
<head>
http://code.jquery.com/jquery-1.9.1.js
http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js
<script>
$(document).ready(function(){
$('#myForm').on('submit',function(event) {
$.ajax({
url:'success.php',          //target file
data:$(this).serialize(),    //translate data structure and object
type:'POST',
success:function(data){

console.log(data);
$("#success").show();       // Show Success Message==
},
error:function(data){

$("#error").show().fadeOut(5000);   //===Show Error Message====
}
});
event.preventDefault();         //To Avoid Page Refresh and Fire the Event "Click"
});
});
</script>

</head>
<body>
<h2 >Registration Form</h2>

<table align:center>
<form id="myForm" method="POST" action="" >
<tr>
<tr><td>Name :</td><td><input type="text" name="name" required></td></tr>
<tr><td>SarName :</td><td><input type="text" name="sarname" required></td></tr>
<tr><td>Birthday :</td><td><input type="date" name="bday" required></td></tr>
<tr><td>E-mail :</td><td><input type="email" name="email" required></td></tr>
<tr><td>Password :</td><td><input type="password" name="password" required></td></tr>
<tr><td>re-Password :</td><td><input type="password" name="passward" required></td></tr>
<tr><td><button type="submit" name="submit" id="submit">submit</button></td> </tr>
</tr>
<span id="error" style="display:none; color:#F00">Some Error!Please Fill form Properly </span>

<span id="success" style="display:none; color:#0C0">All the records are submitted!</span>
</form>
</table>

<?php ?>
</body>

</html>

This is success.php…

View original post 100 more words