有人可以解释为什么这个简单的表格不起作用吗?
问题是当我使用mysql_real_escape_string()
结果时什么都没有,当我删除它时它可以完美运行,你能看看这里有什么问题吗?
这是完整的简单代码,
<?php
// Loop the post fields
$postFields = array('username', 'password', 'checkSubmission');
$postArray = array();
foreach($postFields as $postVal){
$postArray[$postVal] = mysql_real_escape_string($_POST[$postVal]);
}
print_r($postArray);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Signin</title>
<head>
</head>
<body><? echo $error;?>
<form action="<?php echo $_SERVER['PHP_SELF']?>" method="post" id="signinForm">
Username: <input type="text" name="username" value="" />
Password: <input type="password" name="password" value="" />
<input type="hidden" name="checkSubmission" value="1" />
<input type="submit" name="Submit" value="Signin" />
</form>
</body>
</html>
编辑:
我使用print_r()
时是空的mysql_real_escape_string()
Array ( [username] => [password] => [checkSubmission] => )
这就是print_r()
没有mysql_real_escape_string()
Array ( [username] => thre[password] => werr[checkSubmission] => 1)
谢谢你的帮助