我正在尝试将html表单发布到自己,但不知怎的,我没有得到结果。我有两个PHP文件。一个文件名为form.php,看起来像这样
<form action = "" method = "post">
First name: <input name ="first_name" type = "test" size = 20" maxlength = "20"><p>
Second name name: <input name ="second_name" type = "test" size = 20" maxlength = "20"><p>
<input name = "submit" type="submit" value = "submit">
</form>
另一个名为names.php,包括form.php
<?Php
if(!isset($_POST['submit'])){
include "form.php";
}
else{
echo $_POST['first_name'];
echo $_POST['second_name'];
?>
问题是姓名没有回应。我知道这看起来像一个简单的问题,但有趣的是它对我不起作用。在这个问题上,我的斗智斗勇。这是浏览器问题吗?这是一个HTML问题还是一个php问题?
答案 0 :(得分:0)
关闭(&#34;)时出现语法错误。先解决这个问题。我希望你的代码可以正常工作
<form action = "" method = "post">
First name:
<input name ="first_name" type = "text" size = "20" maxlength = "20"><p>
Second name name:
<input name ="second_name" type = "text" size = "20" maxlength = "20"><p>
<input name = "submit" type="submit" value = "submit">
</form>
答案 1 :(得分:0)
1)改变类型=&#34;测试&#34;输入=&#34;文字&#34;
2)缺少关闭括号