每当我提交我的php表单时,数据在数据库中显示为空白。什么不起作用?我尝试将代码设置为不同,但无论我做什么,这些值最终都是空白的。
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
if (isset($_POST["email"]))
{
$login = $_POST["email"];
}
else
{
$login = null;
}
if (isset($_POST["psw"]))
{
$psw = $_POST["psw"];
}
else
{
$psw = null;
}
$login2 = mysqli_real_escape_string($conn, $login);
$psw2 = mysqli_real_escape_string($conn, $psw);
$verify = "INSERT INTO test (email, password) VALUES ('$login2', '$psw2')";
$verify2 = mysqli_query($conn, $verify);
$conn->close();
?>