我现在遇到了一个问题。我有我的html登录页面,一旦我点击登录,它会跳转到php,运行php并从xml抓取数据。但是,当我单击登录时。它将跳转到php而不采取任何操作。
有人知道代码缺少什么吗?
Html页面:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<fieldset>
<form method="post" action="login.php">
<p>Email* : <input type="email" name="email" id="email"/></p>
<p>Password* : <input type="password" name="password" id="password"/>
</p>
<div class="buttoninput">
<input type="submit" name="login "value="Login" />
<input type="reset" value="Reset" />
</div>
</form>
</fieldset>
</body>
</html>Php页面:
<?php
session_start();
if(isset($_POST['login'])) {
$email = $_POST['email'];
$pass = $_POST['password'];
$customerxml = simplexml_load_file('customer.xml');
$email_add = "";
$passw = "";
$customerID = "";
for($i = 0; $i < count($customerxml); $i++){
$email_add = $customerxml->info[$i]->Email;
$passw = $customerxml->info[$i]->Password;
$customerID = $customerxml->info[$i]->CustomerID;
if(($email != $email_add) || ($passw != $pass)){
$message = "wrong email/password";
echo "<script type='text/javascript'>alert('$message');</script>";
}
if(($email == $email_add) && ($passw == $pass)){
$_SESSION['logged_in'] = true;
unset($mydata->info[$i]->Password);
$_SESSION['customer-info'] = json_encode($customerxml->info[$i]);
exit(header("Location: ./bidding.php"));
}
}
}
?>发布于 2018-05-03 19:07:28
<input type="submit" name="login "value="Login" />name="login "中有空格,请删除即将失败空间if(isset($_POST['login'])) {的space.because
发布于 2018-05-03 19:10:17
替换此行
if(isset($_POST['login'])) {通过
if(isset($_POST['email']) && isset($_POST['password'])) {在login.php文件中或删除中的空格
<input type="submit" name="login "value="Login" />(name="login ")
https://stackoverflow.com/questions/50153429
复制相似问题