<?php
if ($_post[ok])
{
$link _id = mysql_connect ("localhost", "root", "") or Die ("Connection failed");
if ($link _id)
{
Select Database
mysql_select_db ("My_test");
Insert Data SQL statement
$sql = "INSERT into userinfo values ('. $_post[id]." ', ' ". $_post[name]." ', ' ". $_post[gender]." ', '. $_post[age]. "', '". $ _post[regdate]. "')";
Execute SQL statement
$result =mysql_query ($sql);
if ($result)
{
echo "Record has been successfully inserted into <br><a href= ' insert.php ' > Continue insert record </a>";
}
Else
echo "Failed to execute INSERT SQL statement";
Close Database
Mysql_close ($link _id);
}
}
Else
{
?>
<form Method=post action=insert.php>
Number <input type=text name= "id" ><br>
Name <input type=text name= "name" ><br>
Gender <input type=text name= "gender" ><br>
Ages <input type=text name= "age" ><br>
Registration time <input type=text name= "RegDate" ><br>
<input type=submit Name=ok value= "Submit" >
</form>
?
}//end if
?>