1. Create form.php and copy below code into file.
<script type="text/javascript">
$(document).ready(function(){
$('#submit').click(function(){
var name= $('#name').val();
var email= $('#email').val();
var sdatatring='name1='+ name +'&email1='+ email;
$.ajax({
type:"POST",
url:"insert.php",
data:sdatatring,
cache: false,
success:function(result){
alert(result);
}});
});
});
</script>
<form method="post" action="" name="frm">
Name:<input type="text" name="name" id="name" value=""><br>
Email:<input type="text" name="email" id="email" value=""><br>
<input type="button" name="submt" id="submit" value="submit" />
</form>
2. Create insert.php and copy below code into file.
<?php
print_r($_POST);
$con=mysql_connect("localhost","root","");
mysql_select_db('dbname');
mysql_query('insert into tablename('colname')values(value)');
?>
Note:You need to include jQuery library in form.php.
<script type="text/javascript">
$(document).ready(function(){
$('#submit').click(function(){
var name= $('#name').val();
var email= $('#email').val();
var sdatatring='name1='+ name +'&email1='+ email;
$.ajax({
type:"POST",
url:"insert.php",
data:sdatatring,
cache: false,
success:function(result){
alert(result);
}});
});
});
</script>
<form method="post" action="" name="frm">
Name:<input type="text" name="name" id="name" value=""><br>
Email:<input type="text" name="email" id="email" value=""><br>
<input type="button" name="submt" id="submit" value="submit" />
</form>
2. Create insert.php and copy below code into file.
<?php
print_r($_POST);
$con=mysql_connect("localhost","root","");
mysql_select_db('dbname');
mysql_query('insert into tablename('colname')values(value)');
?>
Note:You need to include jQuery library in form.php.
Nice site....Please refer this site also Our vision success!Training are focused on perfect improvement of technical skills for Freshers and working professional. Our Training classes are sure to help the trainee with COMPLETE PRACTICAL TRAINING and Real time methodologies
ReplyDeleteDot Net Course in Chennai | Best Dot Net Training Institute in Chennai
Testing Courses in Chennai | Best Software Testing Training Institute in Chennai With Placement
Core Java Training in Chennai | Java Certification in Chennai | Java Training Institute in Chennai
PHP Training Institute in Chennai | Best PHP Course in Chennai | Best PHP Training Institutes