我试图将注册数据存储到数据库中,并且它可以在没有出生日期的情况下完美运行。当我输入出生日期时,它永远不会存储到数据库中。会有什么问题?
这是示例代码
include('config.php');
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$fname = mysql_real_escape_string($_POST['firstname']);
$lname = mysql_real_escape_string($_POST['lastname']);
$email = mysql_real_escape_string($_POST['email']);
$dob = $_POST['year'] . '-' . $_POST['month'] . '-' . $_POST['day'];
mysql_real_escape_string($dob);
$password = mysql_real_escape_string($_POST['password']);
$mobilenumber = mysql_real_escape_string($_POST['mobilenumber']);
$postalcode = mysql_real_escape_string($_POST['postalcode']);
}
if(isset($_POST['firstname'])){
if(empty($fname)){
echo '';
}else{
$success=("INSERT INTO customer (FName, LName, DoB, Email, Password, MobileNum, PostalCode)
VALUES ('$fname','$lname','$dob', '$email', '$password', '$mobilenumber','$postalcode')");
mysql_query($success);
Header("Location: ?");
}
}