表格不会提交给网站不同部分的处理程序

时间:2015-01-30 21:31:47

标签: php html forms

好吧,我一直绞尽脑汁,在网上搜索,我找不到答案。 我有自己的形式,非常容易等。

                      <form id="loginForm" method="post" autocomplete="on" action="sign/in">
                          <fieldset id="body">
                              <fieldset>
                                  <input name="email" type="text" placeholder="User Name / Email" id="email" autocomplete="email" required>
                              </fieldset>
                              <fieldset>
                                  <input name="password" type="password" placeholder="Password" id="password" autocomplete="password" required>
                              </fieldset>
                              <input type="submit" id="login" data-url="sign/in" value="Log In">
                          </fieldset>
                          <span><a href="#">Forgot your password?</a></span>
                      </form>

然而,当它提交时,变量$ _POST [“email”]也没有被提交(和$ _POST [“密码”]也是如此..)任何人都知道为什么会这样? 当我通过GET方法发送它时它工作正常。 但由于显而易见的原因,我不这样做。

任何帮助将不胜感激!

== EDIT == 这是PHP代码。请记住,它的临时代码非常混乱。

<?php 
session_start();
include("config.php");

if(!isset($_POST['email']))
{
  echo "File Not Found";
}
else
{
$u = mysql_real_escape_string($_POST["email"]); 
$p = hash(whirlpool, mysql_real_escape_string($_POST['password'])); 
$q = mysql_query("SELECT uid FROM users WHERE email='$u' AND password='$p' LIMIT 1");  

//if ($num_rows == 1)
if (mysql_fetch_array($q, MYSQL_ASSOC))
{           
setcookie('email', $_POST['email'], time() + 2147483647, "/");
setcookie('password', hash(whirlpool, $_POST['password']), time() + 2147483647, "/");

$_SESSION['logged'] = 1;

$qSessions = mysql_query("SELECT * FROM users WHERE email = '" . mysql_real_escape_string($_POST['email']) . "'");
$iSessions = mysql_fetch_row($qSessions);
$_SESSION['uid'] = $iSessions[0];

mysql_query("UPDATE users SET lastip='".$_SERVER['REMOTE_ADDR']."' WHERE email = '" . mysql_real_escape_string($_POST['email']) . "'");

mysql_query("UPDATE users SET status=1 WHERE email = '" . mysql_real_escape_string($_POST['email']) . "'");

setcookie('status', $_SESSION['status'], time() + 2147483647); 
header("location:index.php");
}
else
{
echo "Sorry, there is no registered account with that email or the password is incorrect. Please login again.<br />";
echo "<a href='index.php'>Home</a>";
}
}
?>

0 个答案:

没有答案