Here is my form:
<form action="#" method="post">
<input type="text" size="25" name="firstname" placeholder="First Name" value="<?php echo $fn; ?>"/>
<input type="text" size="25" name="lastname" placeholder="Last Name" value="<?php echo $ln; ?>"/>
<input type="text" size="25" name="username" placeholder="Username" value="<?php echo $un; ?>"/>
<input type="text" size="25" name="email" placeholder="Email" value="<?php echo $em; ?>">
<input type="text" size="25" name="email2" placeholder="Repeat Email" value="<?php echo $em2; ?>"/>
<input type="password" size="32" name="password" placeholder="Password"/>
<input type="password" size="32" name="password2" placeholder="Repeat Password"/><br />
<input type="submit" name="reg" value="Sign Up!"/>
</form>
When on my site and pressing submit (in xampp) I get an error stating
Object not found!
The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.
If you think this is a server error, please contact the webmaster.
Error 404
localhost Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7
I am somewhat new to coding with php, css, and javascript but I've been trying to find a solution to this for 2 days and I keep coming up with nothing.
I am just trying to get the form to stay on the same page after submitting or pressing sign in!
If anyone could help, that would be great! Thanks for reading.
Specifying no action will submit the form to the current page:
<form action="" method="post">
Alternatively use $_SERVER['PHP_SELF']
:
<form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>" method="post">
来源:https://stackoverflow.com/questions/17280809/submission-form-wont-stay-on-same-page