Need help adding php contact code to a template

They have: 1 posts

Joined: Jan 2016

Hi, I took over a website template for my business which had a php contact form, I'm now taking over a responsive website template and am trying to adapt the php contact form from my old website, I'm receiving an email but the fields are blank.

I've been at this for hours, if any one can see where I'm going wrong, I would be very greatful.

Many thanks
Kevin

Here's the code...and all the < are missing on html as this was the only way add this code to to forum..thanks

HTML

form action="contact.php" method="post" type="contactform">

input type="text" class="name" placeholder="name">

input type="text" class="email" placeholder="Email">

textarea placeholder="Message" required>
div class="submit">
input type="submit" value="Send Message">
/div>
/form>
PHP

<?php
$EmailFrom
= $_REQUEST['email'];
$EmailTo = "[email protected]"; // [email protected]
$Subject = "Contact form";
$Name = Trim(stripslashes($_POST['name']));
$Email = Trim(stripslashes($_POST['email']));
$Message = Trim(stripslashes($_POST['message']));

// validation
$validationOK=true;
if (!
$validationOK) {
  echo
"Error";
  exit;
}

// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Message: ";
$Body .= "\n";
$Body .= $Message;
$Body .= "\n";

// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");

// redirect to success page
if ($success){
  echo
"";
}
else{
  echo
"Error";
}
?>

They have: 66 posts

Joined: Jan 2016

Try adding these to their respective input fields:

value="

<?php
echo $Name;
?>

value="

<?php
echo $Email;
?>

value="

<?php
echo $Message;
?>

We don't try. We Do It. -- 3wcorner.com

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.