php.php
<?php
//print_r($_POST);
if(!empty($_POST))
{
$_POST['name'];
$_POST['age'];
$_POST['weight'];
$_POST['height'];
//insert data...
echo "It worked";
}
else
{
echo "It didnt work";
}
?>
text.html
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" >
$(document).ready(function () {
$("#form").submit(function () {
$("#form").serialize();
$.post('php.php', $("#form").serialize(), function (data) {
$('#content').html(data);
});
return false;
});
});
</script>
</head>
<body>
<div id="content" style="border: 1px solid red;">
</div>
<form id="form" >
NAME <input type="text" name="name" /> <br />
AGE <input type="text" name="age" /> <br />
HEIGHT <input type="text" name="height" /> <br />
WEIGHT <input type="text" name="weight" /> <br />
<input type="submit" />
</form>
</body>
</html>