<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Data Store</title>
</head>
<body>
<?php
$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="test"; // Database name
$tbl_name="sample"; // Table name
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// get data that sent from form
//$topic=$_POST;
$name=$_POST;
$password=$_POST;
//$datetime=date("d/m/y h:i:s"); //create date time
$sql="INSERT INTO $tbl_name(name, password)VALUES('$name', '$password')";
$result=mysql_query($sql);
if($result){
echo "Successful<BR>";
echo "<a href=dataview.php>View your topic</a>";
}
else {
echo "ERROR";
}
mysql_close();
?>
</body>
</html>