登录

提交表单,跳转不成功,404.想询问一下是哪里配置错误了吗 ?初学者用到PhpStorm,没有配置

form.html:
<html>
<head>
    <meta charset="utf-8">
    <title>php中文网(php.cn)</title>
</head>
<body>
<form action="welcome.php" method="post">
    名字: <input type="text" name="fname">
    年龄: <input type="text" name="age">
    <input type="submit" value="提交">
</form>
</body>
</html>

welcome.php

欢迎 <?php echo $_POST["fname"]; ?>!<br>
你的年龄是 <?php echo $_POST["age"]; ?>  岁。

# PHP
400°眼镜的沙子 400°眼镜的沙子 1738 天前 969 次浏览

全部回复(4) 我要回复

  • 王林

    王林2019-08-20 17:51:55

    另外需要注意的其他问题是,在打开form.html时一定要通过输入网址的方式打开,不然welcome.php将显示为纯代码页面

    回复
    0
  • 400°眼镜的沙子

    http://localhost/Projects/welcome.php The requested URL /Projects/welcome.php was not found on this server. Apache/2.4.23 (Win64) PHP/7.0.10 Server at localhost Port 80 大概是这样的页面显示

    400°眼镜的沙子 · 2019-08-23 17:29:28
  • kanglecheng

    kanglecheng2019-07-19 14:41:15

    两个文件要在同一个目录下,比如
    page/form.html
    page/welcome.php

    回复
    0
  • 400°眼镜的沙子

    在一个文件夹下的

    400°眼镜的沙子 · 2019-08-23 17:10:01
  • 取消 回复 发送