Create 3 file.
1. File name
input.html
<html>
<header></header>
<body>
<form action="insert.php" method="post">
Username: <input name="adnam" size="20" /><br />
Password: <input name="adpsw" size="20" /><br />
<input type="submit" value="SEND" />
</form>
</body>
</html>
2. File name
insert.php
<?php
$username = $_POST["adnam"];
$password = $_POST["adpsw"];
$conn = mysql_connect('localhost', 'root', '');
if (!$conn)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db('users');
$query="INSERT INTO user (username, password)
VALUES ('$username','$password')";
mysql_query($query);
/*if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}*/
header("location:ok.html");
mysql_close($conn);
?>
3.File name
ok.html
<html>
<head></head>
<body>
User inserted to databasa OK . <a href="input.html">New User</a>
</body>
</html>