so I have my PHP file (it all works fine the php side of it I know this for a fact) located in xampp’s htdocs ‘contact.php’
so In my webpage I have it linked up to there “http://localhost/contact.php” however when I press the button and it runs the php i get “Not Found
HTTP Error 404. The requested resource is not found.”
am I linking it wrong? have I put it in the wrong folder (should I put it in the php www folder / how do I link that up?)
I have placed it in the www folder and am having problems still – I am unsure of how to correctly link it to the php www folder.
it is for a contact form – so my action is <form method="POST" action="http://localhost/contact.php">
my contact.html is as follows.
<div id="contact_form">
<h4>Send us a message now!</h4>
<form method="POST" action="contact.php">
Fields marked (*) are required
<p>Email From:* <br>
<input type="text" name="EmailFrom">
<p>Name:* <br>
<input type="text" name="Name">
<p>Email:* <br>
<input type="text" name="Email">
<p>Phone:* <br>
<input type="text" name="Phone">
<p>Message:<br>
<textarea name="Message"></textarea>
<p><input type="submit" name="submit" value="Submit">
</form>
<p>
</div>
</div>
Possible problems
Either, your
contact.phpwould be in different directory.You are trying to access with WRONG URL, i mean path.
You would have changed your port number to other. Check your Port Number, when you are accessing your main page (i.e.
index.phpor whatever).Suggestion
If your
index.phpandcontact.phpare in same directory i.e.myproject. Then, it’s better to specify onlycontact.phprather than whole URL.Don’t
Do
Note : Always use relative URL instead of actual URL.
UPDATE
When you clicked on SUBMIT button, then check your current URL path, whether it is changed to
contact.phpor not ?? I mean, it mustlocalhost/contact.htmltolocalhost/contact.phpAnd I believe, It must. Since,formis a part ofhtml, which means it doesn’t matter whether your server is running or not. But, yes, if yourcontact.phpwould be in different directory. Then your problem still persist.