I tried this code:
PHP Code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="JavaScript">
function CloseChildWindow()
{
window.opener.location.href="page3.php";
self.close();
}
</script>
</head>
<body>
<form method="post" action="add.php" name="add">
Last Name: <input type="text" name="Last_Name" id="Last_Name"><br/><br/>
First Name: <input type="text" name="First_Name" id="First_Name"><br/><br/>
Birthday: <input type="text" name="Birthday" id="Birthday"><br/><br/>
<input type="submit" name="save" value="SAVE" onClick="CloseChildWindow();">
<?php
//error_reporting(0);
$Lname = "";
$Fname= "";
$bday = "";
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("db_machine1") or die(mysql_error());
if(isset($_POST['save'])){
$Lname=$_POST['Last_Name'];
$Fname=$_POST['First_Name'];
$bday=$_POST['Birthday'];
$date = date('Y-m-d', strtotime($bday));
//$query = "INSERT INTO tbl_machine1 (Last_Name, First_Name, Birthday) VALUES ('$Lname','$Fname','$bday')";
//$result=mysql_query($query);
$sql = mysql_query("INSERT INTO tbl_machine1 (Last_Name, First_Name, Birthday)
VALUES('".$Lname."', '".$Fname."', '".$date."')");
}
?>
</form>
</body>
</html>
And when I insert 1990-05-25 as birthday it did not convert to 25-05-1990
Thank you
Bookmarks