HTML表单不能POST [英] HTML Form Cannot POST
本文介绍了HTML表单不能POST的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在网站上制作用户系统,但无法将表单发布到文件中。
以下是HTML文件中的表单:
I am making a user system on a website and I cannot get the form to post to the file.
Here is the form in the HTML file:
<form method="post" action="php/userlogin.php">
<p><input type="text" name="usernameL" value=""></p>
<p><input type="password" name="passwordL" value=""></p>
<p><input type="submit" name="submit" value="Login"></p>
</form>
以及php目录中的userlogin.php:
And the userlogin.php in the php directory:
<?php
$username = $password = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$username = test_input($_POST["usernameL"]);
$password = test_input($_POST["passwordL"]);
}
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>
我是新来的表单,无法在任何地方找到答案,甚至无法找到答案。我该如何解决这个问题?
I'm new to forms and can't find an answer anywhere or even a question like this. How would I fix this?
推荐答案
代码很好。
只输出变量的值。
Code is fine. Just output the values of the variables.
echo $username.' '.$password;
您可以看到数据正在发布。
You can see that the data is being posted.
这篇关于HTML表单不能POST的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文