<?php
$host="localhost"; // Host name
$username="root"; // Mysql username
$password="root"; // Mysql password
$db_name="libedb"; // Database name
$tbl_name="test_mysql_in"; // Table name
$now = date("Y-m-d h:i:s"); //show datetime
// 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 values from form
$user_id_card=$_POST['name'];
// Insert data into mysql
$sql="INSERT INTO $tbl_name(user_id_card,datenow)VALUES('$user_id_card',now())";
$result=mysql_query($sql);
if($result){
include "head.php";
echo "<center><font face='Angsana New' size='5' color='#000000'><b><br>** เพิ่มข้อมูลเรียบร้อยแล้ว **<br><br><br><br><br><br><br><br></b><font><br>";
echo"<meta http-equiv=\"refresh\" content=\"2; url=in1.php\" />";
include "footer.php";
}else{
include "head.php";
echo "<center><font face='Angsana New' size='5' color='#000000'><b><br>ไม่สามารถเพิ่มข้อมูลได้ !<br><br><br><br><br><br><br><br></b><font><br>";
echo"<meta http-equiv=\"refresh\" content=\"2; url=in1.php\" />";
include "footer.php";
}
?>
<?php
mysql_close();
?>