加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – 404提交表单时出错

发布时间:2020-12-13 13:54:51 所属栏目:PHP教程 来源:网络整理
导读:尝试提交此表单时,我一直收到404错误.在我的网站目录中,我有一个名为mobile的文件夹,里面有forms.php和process.php. 表单位于此页面上 http://localhost/mobile/forms.php?ft=0id=2 这是表格 form action='/mobile/process.php?o=9ft=0' method='POST'//deta
尝试提交此表单时,我一直收到404错误.在我的网站目录中,我有一个名为mobile的文件夹,里面有forms.php和process.php.

表单位于此页面上

http://localhost/mobile/forms.php?ft=0&id=2

这是表格

<form action='/mobile/process.php?o=9&ft=0' method='POST'>
//details
</form>

当我尝试提交时我得到404错误,当它应该转到http://localhost/mobile/process.php?o = 9& ft = 0?我该如何解决?

通过查看URL我得出的结论是两个php文件都在同一页面上,所以改变你的动作网址
<form action='/mobile/process.php?o=9&ft=0' method='POST'>

<form action='process.php?o=9&ft=0' method='POST'>

移动设备之前的正斜杠意味着它从根目录中选择文件夹..所以你可能不需要这里.

最后但并非最不重要的是,确保文件名正确,并确保案例相同,因为文件名区分大小写.

Note: You may also get 404 error if you are using header('Location:
xyz.php');
on the form processing page,for redirecting the user to
some page after the form processes and you may encounter 404 because
the page on which the script has redirected doesn’t exist. so make sure
that the URL is correct if you are using header()

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读