3

尝试提交此表单时,我不断收到 404 错误。在我的网站目录中,我有一个名为 的文件夹mobile,里面有forms.phpprocess.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?我该如何解决?

4

3 回答 3

2

By looking at the URL's what I conclude is that both the php files are on the same page so change your action url from

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

To

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

A forward slash before the mobile means it selects the folder from the root.. So you probably don't need that here.

Last but not the least, be sure the file names are proper, and also make sure the cases are same, because the file names are case sensitive.

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()

于 2013-07-24T15:29:49.630 回答
0

Try changing

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

to

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

Since they are in the same directory.

于 2013-07-24T15:29:16.620 回答
-1

您不能在表单操作中传递 GET 参数。

为了传递参数,您必须创建一个隐藏输入,例如:

<input type="hidden" name="o">
于 2013-07-24T15:31:24.403 回答