Hi everyone!
I have used a contact form taken from a hard-coded site, along with it's corresponding php file, and i'm trying to implement it on a new wordpress site.
The contact form was working on the old site, and i haven't altered any code, i'm wondering why it won't work in wordpress...
anyway, here is the form code in my page-home.php file:
<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> </span>
<input type="submit" class="button" value="connect" />
</div>
</form>
</div>
and here is the contact_me.php file:
<?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;
?>
I am left with error 404, which i have no idea why (permissions of the contact_me.php maybe?) and another error saying index.php not found, which is very weird as it is not mentioned at all in the code....
Any ideas/suggestions/advice would be very grateful
thanks