1 Reply Latest reply on Mar 3, 2010 4:25 PM by Günter Schenk

    Php email showing nothing

    trademark13

      So I am trying to develop a quick contact form, where all I went sent to my email is the person's name and email.

       

      My php is working, I do get an email when the form is completely filled out, but the fields in my email show up blank.

      my php code is this:

       

      <?php

      $msg = "Name:$name";

      $msg .= "Email: $email";

      $recipient = "aratplyers13@yahoo.com";

      $subject = "New Feedback from my site";

      mail($recipient, $subject, $msg, $mailheaders);

      header("Location: http://tivativamusic.com/email.html");

      ?>

       

      and in the message of the email says this:

      Name: Email:

      it does not show the email nor the name that was put into the fields of the form

        • 1. Re: Php email showing nothing
          Günter Schenk Level 4

          If you´re passing the form´s values using the POST method, use this in your PHP script:

           

          $name = addslashes($_POST['name']);

          $email = addslashes($_POST['email']);

           

          $msg = "Name: $name";

          $msg .= "Email: $email";

           

           

          This is of course a very basic example which lacks important aspects like validating whether the form fields are not empty and if the email field comtains a valid email address.

           

          Cheers,

          Günter