I've got an annoying problem.
My website https://exmple.com has a contact form.
The logic is placed in the same directory as the send.php file.
In general, an email form works, however, sometimes I get "Server not found" error (1/10). What may be to resign for this weird behaviour?
The form looks like:
<form method="post" action="send.php">
...
</form>
I've already tried:
action = "send.php"
action = "/send.php"
action = "https://exmple.com/send.php"
Each try gives the same result.
This is a SSL connection, index.php file is in the same directory as send.php.
Thanks for your help!
Related
I was working on XAMPP when I encountered this.
My code was intended to take some information as input from the user via a form.
Then show the output in the same page after the "SUBMIT" button has been pressed.
(I used " method="POST"> in the HTML part of the code...)
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.33 (Win32) OpenSSL/1.1.0g PHP/7.2.4
Thanks in Advance
The problem is that you are sending the form to a page that doesn't exist. Make sure you use $_SERVER['PHP_SELF'] in the action attribute of your form.
Example:
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
Everything works well behind the scene but my clients see a Page not found after Posting a form.
The form.php must have been found otherwise the data wouldn't be parsed to my e-mail smoothly. I have a redirection page: thankpage.html, which is up and running well when I type its address directly.
what could be going on? any help please?
Anyway,
Instead of calling the Thankpage.html from the form.php, I inserted the following into my "form" element in the contact.html page itself:
onsubmit="window.location.href='http://www.inglesparticular-sp.com/thankpage.html';"
So it is now:
<form role="form" id="contact-form" method="post" action="form.php" onsubmit="window.location.href='http://www.inglesparticular-sp.com/thankpage.html';">
Somehow it's all working well and I have no "PAGE NOT FOUND" messages!!!
Sorry if I wasn't clear on the question, it's my first one as you can see... cheers!
I created a form in php named form.php, gave the error statements in the same file. I created another php file named test.php which connects form.php to my local database and submits the data. Now in form.php if I use
form action="test.php" method="post" name="form1"
it directly submits data into the database without judging or showing the errors, if I use
form action=" htmlspecialchars($_SERVER["PHP_SELF"])" method="post" name="form1"
then it judge and shows the errors but does not submit the data to my database.
Please help me in this regard.
It seems you've written the errors checking and validation conditions in your 'form.php' script, and connections with your db are done through the 'test.php'.
A better way would be to keep everything on the same file. Move your connection code to form script, and that should work.
The reason is if you write form action="test.php" method="post" name="form1"
the values of the form are directly transferred to the test.php, and no code of form.php is interpreted. When you do the latter, the test.php isn't considered at all, because it doesn't get any info saying that go to that file.
I keep getting a 404 error when trying to submit this form. In my website directory i have a folder called mobile, which inside has forms.php and process.php.
The form is located 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 it should go to http://localhost/mobile/process.php?o=9&ft=0? How do i fix this?
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()
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.
You can't pass a GET parameter in the form action.
In order to pass parameters, you will have to create a hidden input like :
<input type="hidden" name="o">
Hi I have a form that is submitted after a JS file has completed validation checks
in the form the main line is
<form style='background-color:ccc' id='form1' name='form1' method='post' action='dual_process.php' > ;
The code for submitting the form is (This calls a JS script)
<input class="buttn" type="button" name="su" id="su" value="Confirm and Submit Details" <? echo "onclick='$validate;' " ?> />
After the JS script have validated the form the following line is executed
if (!msg) {
var frm = document.getElementById("form1");
frm.submit() ;
This all worked fine until I moved to a new web host now when I submit the form I get the following error
Forbidden
You do not have permission to access this document.
Could anyone suggest what I am doing wrong OR if there is something that the new host does not like (Old host Simple Web Hosting New one IDAQ )
Thanks I advance for any help
Mick
Hy,
Try use double quotes to the form attributes: action="dual_process.php", and the others.
The most common reason for the 403 error is that directory browsing is forbidden for the Web site.
Check if you can directly access the "dual_process.php" page, and maybe a better response can give you the administrator of that server.