404 on form submission

I keep getting 404 error when I try to submit this form. In my site directory, I have a named folder mobile

that has forms.php

and inside it process.php

.

The form is on this page

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

      

here is the form

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

      

When I try to submit, I get a 404 error, when should it go to http://localhost/mobile/process.php?o=9&ft=0

? How to fix it?

+1


source to share


3 answers


By looking at the url, I conclude that both php files are on the same page, so change the url of the action from

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

      

For

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

      



The forward slash before mobile

means that it selects the folder from the root. So you probably don't need this here.

Last but not least, make sure the filenames are correct, and also make sure the cases are the same because the filenames are case sensitive.

Note. You can also get a 404 error if you use header('Location: xyz.php');

on the form processing page to redirect the user to some pages after the form process, and you may run into 404

because the page the script is redirected to does not exist. so make sure the url is correct if you useheader()

+2


source


Try to change

<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.

0


source


You cannot pass a GET parameter to a form action.

In order to pass parameters, you will need to create a hidden input, for example:

<input type="hidden" name="o">

      

-1


source







All Articles