前端之家收集整理的这篇文章主要介绍了
php – 404提交表单时出错,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
尝试提交此表单时,我一直收到
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?我该如何解决?
@H_
404_12@
通过查看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()