Form results

i have a form the input fields are

Business ID (form name id)

Business Email (form name Email)

Subject (form name Subject)

Message (form name Message)

form action is sendpromo.php

here is the sendpromo.php code

<?php //check the email is real if (filter_var($_POST['Email'], FILTER_VALIDATE_EMAIL)) { $to = $_POST['Email']; $subject = $_POST['Subject']; $message = $_POST['Message']; $headers = 'From: myemailaddress' . "\r\n" . 'Reply-To: myemailaddress' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); } header("Location: redirect.php"); ?>

in the redirect page i want to display a message that says … The email has been sent to the Business ID (id) who;s Business Email is (Email) With the following message (message)

thanks for any advice.

One piece of advice is you will get more help if you format your php code properly.

1 Like

Hello webchambers, it will be easier to read your code if you place the php in code blocks like so:

[code]
<?php
  //always exit; after a header redirect
  header('Location: /');
  exit;
?>
[/code]
<?php //check the email is real

  if (filter_var($_POST['Email'], FILTER_VALIDATE_EMAIL)) {
      $to = $_POST['Email']; $subject = $_POST['Subject']; $message = $_POST['Message'];
      $headers = 'From: myemailaddress' . "\r\n" . 'Reply-To: myemailaddress' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
      mail($to, $subject, $message, $headers);
  }
  header("Location: redirect.php");
?>
1 Like

<?php
//check the email is real
if (filter_var($_POST['Email'], FILTER_VALIDATE_EMAIL)) {
    $to      = $_POST['Email'];
    $subject      = $_POST['Subject'];
    $message      = $_POST['Message'];
    $headers = 'From: [email protected]' . "\r\n" .
    'Reply-To: [email protected]' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();



mail($to, $subject, $message, $headers);





}

header("Location: redirect.php");
?>

store the value anywhere. Database, Session, local storage.

1 Like
Sponsor our Newsletter | Privacy Policy | Terms of Service