Ajax code, background PHP
Form form content name, Age,sex, submit the Insert () method to the background index.php, using post mode. For detailed code, it is not
------to solve the idea----------------------
Suggest LZ or carefully learn the front-end knowledge
Sample.html
Html
index.php
function Insert () {
$ret = Array (' Code ' =>1, ' msg ' = ' data not valid ');
Extract ($_post);
/*
* Execution Logic
* Insert Database $name $age $sex
*/
$ret [' code '] = 1;
echo Json_encode ($ret);
}
Insert ();
------to solve the idea----------------------
Form code
index.php Code
$name =$_post[' name '];
$age =$_post[' age ';
$sex =$_post[' sex '];
function Insert ($name, $age, $sex) {
echo $name. $age. $sex;
}
Insert ($name, $age, $sex);
------to solve the idea----------------------
Well, with so much, I won't submit ... Learn more. A lot of information online