Posting Name In Email Form?

Discussion in 'PHP' started by gobbly2100, Sep 11, 2007.

  1. #1
    Hey,

    I have this script I found and I am now using but the box where people enter their name seems pointless as I don't actually see their name in the email I receive.

    PHP Code
    <?php
    if($_POST['do']=="send") {
    $recipient="email"; // Set your email here //
    $subject=$_POST['subject'];
    $name=$_POST['name'];
    $email=$_POST['email'];
    $message=$_POST['message'];
    $formsend=mail("$recipient", "$subject", "$message", "From: $name ($email)\r\nReply-to:$email");
    echo("<p>Your message was successfully sent!</p>");
    }
    ?>
    Code (markup):
    HTML Code
    <form method="post" action="">
    <p>Name:<br>
    <input name="name" type="text" />
     </p>
    <p>Email:<br>
    <input name="email" type="text" />
     </p>
    <p>Subject:<br>
    <input name="subject" type="text" />
     </p>
    <p>Message:<br>
    <textarea name="message" rows="6"></textarea>
     <br />
    <input type="submit" value="Send" /><input type="hidden" name="do" value="send" /><input type="reset" value="Reset" />
     </p></form>
    Code (markup):
    Thanks in advance if you can help.
     
    gobbly2100, Sep 11, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    nico_swd, Sep 11, 2007 IP