Quantcast
Channel: Topic Tag: contact-form | WordPress.org
Viewing all articles
Browse latest Browse all 6001

Khadesa on "Contact Form error 404"

$
0
0

Hey programming pals,

I am having trouble with what else, a contact form.

I have styled and placed in my own form, in my home-page.php, here is the code:

<div class="formbox">
<form action="contact_me.php" method="post" class="STYLE-NAME">
<div class ="label">
<input id="name" type="text" name="name" placeholder="Name" />
</div>
<div class ="label">
<input id="phone"  type="text" name="phone" placeholder="Phone Number" />
</div>
<div class ="label">
<input id="email" type="email" name="email" placeholder="Email" />
</div>
<div class ="label">
<textarea id="message" name="message" placeholder="Message"></textarea>
</div>
<div class ="label">
<span>&nbsp;</span>
<input type="submit" class="button" value="connect" />
</div>
</form>
</div>

And here is the corresponding contact_me.php:

<?php
// Check for empty fields
if(empty($_POST['name'])  		||
   empty($_POST['email']) 		||
   empty($_POST['phone']) 		||
   empty($_POST['message'])	||
   !filter_var($_POST['email'],FILTER_VALIDATE_EMAIL))
   {
	echo "No arguments Provided!";
	return false;
   }

$name = $_POST['name'];
$email_address = $_POST['email'];
$phone = $_POST['phone'];
$message = $_POST['message'];

// Create the email and send the message
$to = 'a.moses.mosaic@gmail.com'; // Add your email address inbetween the '' replacing yourname@yourdomain.com - This is where the form will send a message to.
$email_subject = "Website Contact Form:  $name";
$email_body = "You have received a new message from your website contact form.\n\n"."Here are the details:\n\nName: $name\n\nEmail: $email_address\n\nPhone: $phone\n\nMessage:\n$message";
$headers = "From: noreply@yourdomain.com\n"; // This is the email address the generated message will be from. We recommend using something like noreply@yourdomain.com.
$headers .= "Reply-To: $email_address";
mail($to,$email_subject,$email_body,$headers);
return true;
?>

Any idea's why this is not sending mail?

Thanks!


Viewing all articles
Browse latest Browse all 6001