我有一些麻烦得到一个简单的PHP登录表单传递和检查登录数据对数据库。出于某种原因,数据不会从Html表单传递到PHP处理程序。两者都是单独的文件,但代码如下:PHP POST数据不显示
<html>
<head>
<title>Login</title>
</head>
<body>
<h1> Welcome please Login: </h1>
<form action="LoginCreate.php" method="post">
Username: <input type=“name” name=“username” id="username"><br/>
Password: <input type="password” name=“password” id="password"><br/>
<input type="submit" value="Login"> <input type="submit" value="Create Account">
</form>
那么对于PHP FIKE:(请注意,我还没有被添加到代码针对数据库检查。)
<?
$db=sqlite_open("database.db");
$username = sqlite_escape_string($_POST["username"]);
$password = sqlite_escape_string($_POST["password"]);
if(isset($_POST['Create Account'])){
sqlite_query($db,"INSERT INTO username (name) VALUES ('$username')");
sqlite_query($db,"INSERT INTO password (password) VALUES ('$password')");
echo "<p> Account Created. <p>";
}
else if(isset($_POST['Login'])){
echo "<p> Login Successful. <p>";
}
sqlite_close($db);
?>
什么应该导致数据不能正确发布,我的语法错了吗?我使用的是MicroApache,并且没有在Chrome中弹出错误。
好了,你有一个不存在的用户名了'type'声明 - 不是说这就是问题所在,但它应该是“文本”,而不是“名称”。 – junkfoodjunkie
尝试print_r($ _ POST);并看看是否显示任何内容,帮助你缩小范围 – clearshot66