Shalini Guha
Shalini Guha

Reputation: 21

"POST /mail.php" Error (404): "Not found"

I'm trying to make a simple contact form but I keep getting this error while trying to submit a response. The code is:

HTML :

 <form action="mail.php" method="POST" class="submitphoto_form">
            <input type="text" name ="name" class="wp-form-control wpcf7-text" placeholder="Your name">
            <input type="mail" name="email" class="wp-form-control wpcf7-email" placeholder="Email address">          
            <textarea  name="message" class="wp-form-control wpcf7-textarea" cols="30" rows="10" placeholder="What would you like to tell us"></textarea>
            <input type="submit" value="Submit" class="wpcf7-submit">
          </form>

PHP :

<?php $name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$formcontent="From: $name \n Message: $message";
$recipient = "[email protected]";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!" . " -" . "<a href='contact.html' style='text-
decoration:none;color:#ff0099;'> Return Home</a>";
?>

Both the files are in the same folder.

Upvotes: 1

Views: 3880

Answers (2)

user9272852
user9272852

Reputation:

You need to configure your apache server locally if you are not working on a server because php scripts runs only on a server environment where php is installed.

In case you have apache server installed already, check if its running and your working directory is correct.

Upvotes: 0

There are three possibilities you get this error message

A) File name is not valid that you have (check case insensitivity)

B) Extension is invalid or not mentioned

C) File path is incorrect (check cases and double check file presence)

Upvotes: 1

Related Questions