Jump to content

topolino

New Members
  • Posts

    1
  • Joined

  • Last visited

topolino's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. First off I want to add the $Surname field into the email header so it shows not just from Name but from Name and Surname, when the recipient receives the form data. Second, how can I make the PHP respond to this data by extracting the $Name and $Surname fields, such that the person filling it in receives an email saying Thank you $firstname $lastname for your recent testimonial.etc etc Any help would be appreciated. Here is the PHP code I am using: <?php session_cache_limiter('nocache'); header('Expires: ' . gmdate('r', 0)); header('Content-type: application/json'); $Recipient = 'testimonials@carlharrisonmotorcycles.co.uk'; // <-- Set your email here $subject = $_POST['subject']; if($Recipient) { $Name = $_POST['name']; $Surname = $_POST['surname']; $Email = $_POST['email']; $Subject = $_POST['subject']; $Message = $_POST['message']; $Manufacturer = $_POST['manufacturer']; $Model = $_POST['model']; $Email_body = ""; $Email_body .= "First Name: " . $Name . "\n" . "Last Name: " . $Surname . "\n" . "Email Address: " . $Email . "\n" . "Subject: " . $Subject . "\n" . "Testimonial: " . $Message . "\n" . "Motorcycle Make: " . $Manufacturer . "\n" . "Motorcycle Model: " . $Model . "\n"; $Email_headers = ""; $Email_headers .= 'From: ' . $Name . ' <' . $Email . '>' . "\r\n". "Reply-To: " . $Email . "\r\n"; $sent = mail($Recipient, $Subject, $Email_body, $Email_headers); if ($sent){ $emailResult = array ('sent'=>'yes'); } else{ $emailResult = array ('sent'=>'no'); } echo json_encode($emailResult); } else { $emailResult = array ('sent'=>'no'); echo json_encode($emailResult); } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.