Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

PHP + HTML Form: The email I receive does not show the info that the user types in

New Here ,
Aug 24, 2018 Aug 24, 2018

For some reason when a user submits this form, I'll get in an email back and only see the following:

From:

Email:

Address:

Here is my PHP file (note: I blocked my email address):

<?php

/* Set e-mail recipient */

$myemail = <My email goes here>

$subject = "Registration Form";

/* Check all form inputs using check_input function */

$first_name = $_POST['first_name'];

$last_name = $_POST['last_name'];

$address = $_POST['address'];

$city = $_POST['city'];

$state = $_POST['state'];

$zip = $_POST['zip'];

$tel = $_POST['tel'];

$email = $_POST['email'];

$dept = $_POST['dept'];

$course = $_POST['course'];

/* Let's prepare the message for the e-mail */

  $message = "Form details below.\n\n";

 

  $message = "From: $first_name\n E-Mail: $email\n Address:\n $address";

$subject ="Registration Form";

/* Send the message using mail() function */

mail($myemail, $subject, $message);

/* Redirect visitor to the thank you page */

header('Location: thanks.html');

exit();

/* Functions we used */

function check_input($data, $problem='')

{

  $data = trim($data);

  $data = stripslashes($data);

  $data = htmlspecialchars($data);

  if ($problem && strlen($data) == 0)

  {

  show_error($problem);

  }

  return $data;

}

function show_error($myError)

{

?>

  <html>

  <body>

  <b>Please correct the following error:</b><br />

  <?php echo $myError; ?>

  </body>

  </html>

<?php

exit();

}

?>

  function clean_string($string) {  $bad = array("content-type","bcc:","to:","cc:","href");  return str_replace($bad,"",$string);  }
286
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 25, 2018 Aug 25, 2018
LATEST

The HTML form must contain the exact same names as your script.

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines