f.php page code:
<?php
try
{
$cn=mysql_connect('localhost','root','') or die('Error on connetion:'.mysql_error());
$db=mysql_select_db('sankar') or die('Error on database:'.mysql_error());
$id =$_GET['id'];
$name1 =$_GET['ab'];
$age = $_GET['age'];
$cm=mysql_query("insert into emp values($id,$name1,$age)");
echo "One record saved.";
mysql_close($cn);
}
catch (Exception $e)
{
die('Erreur : ' . $e->getMessage());
}
?>
d.php page code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script language="javascript" type="text/javascript" src="jquery-1.7.1.js"></script>
<script language="javascript" type="text/javascript" src="jquery-1.7.1.min.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function () {
$('#c').on('click', function () {
alert('siv')
var id= $('#a').val();
var ab=$('#b').val();
var age= $('#g').val();
$.getJSON('/f.php',{id:id,ab:ab,age:age},function(data)
{
$('#dv').html(data);
});
});
});
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form name="frm" id="frm" action="#" method="post" enctype="multipart/form-data">
<table align="center">
<tr><td>EID</td><td><input type="text" name="a" id="a" size="15" maxlength="10" /></td></tr>
<tr><td>Name</td><td><input type="text" name="b" id="b" size="30" maxlength="50" /></td></tr>
<tr><td>Age</td><td><input type="text" name="g" id="g" size="30" maxlength="50" /></td></tr>
<tr><td> </td><td><input type="button" name="c" id="c" value="Save" style="width:80px" /> <input type="submit" name="f" id="f" style="width:80px" value="Update" /> <input type="reset" name="d" id="d" value="Reset" style="width:80px" /> </td></tr>
<tr><td> </td><td><div id="dv"></div></td></tr>
</table>
</form>
</body>
</html>
<?php
try
{
$cn=mysql_connect('localhost','root','') or die('Error on connetion:'.mysql_error());
$db=mysql_select_db('sankar') or die('Error on database:'.mysql_error());
$id =$_GET['id'];
$name1 =$_GET['ab'];
$age = $_GET['age'];
$cm=mysql_query("insert into emp values($id,$name1,$age)");
echo "One record saved.";
mysql_close($cn);
}
catch (Exception $e)
{
die('Erreur : ' . $e->getMessage());
}
?>
d.php page code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script language="javascript" type="text/javascript" src="jquery-1.7.1.js"></script>
<script language="javascript" type="text/javascript" src="jquery-1.7.1.min.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function () {
$('#c').on('click', function () {
alert('siv')
var id= $('#a').val();
var ab=$('#b').val();
var age= $('#g').val();
$.getJSON('/f.php',{id:id,ab:ab,age:age},function(data)
{
$('#dv').html(data);
});
});
});
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form name="frm" id="frm" action="#" method="post" enctype="multipart/form-data">
<table align="center">
<tr><td>EID</td><td><input type="text" name="a" id="a" size="15" maxlength="10" /></td></tr>
<tr><td>Name</td><td><input type="text" name="b" id="b" size="30" maxlength="50" /></td></tr>
<tr><td>Age</td><td><input type="text" name="g" id="g" size="30" maxlength="50" /></td></tr>
<tr><td> </td><td><input type="button" name="c" id="c" value="Save" style="width:80px" /> <input type="submit" name="f" id="f" style="width:80px" value="Update" /> <input type="reset" name="d" id="d" value="Reset" style="width:80px" /> </td></tr>
<tr><td> </td><td><div id="dv"></div></td></tr>
</table>
</form>
</body>
</html>
No comments:
Post a Comment