The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.


Results 1 to 6 of 6

Thread: Re-jig PHP Email form

  1. #1

    Re-jig PHP Email form

    Hi all

    I was wondering if some one could help me with my PHP code.

    HTML Code:
    <?php
    
    $sendTo = "g_rochford@xxx.co.uk";
    $subject = "Contact Form";
     
    $headers = "From: " . $_POST["email"] . "\r\n";
    
    $headers .= "Reply-To: " . $_POST["email"] . "\r\n";
    
    $headers .= "Return-path: " . $_POST["email"];
     
    $message .= "Message: " . $_POST["message"] . "\r\n";
    $message .= "Name: " . $_POST["name"] . "\r\n";
    $message .= "Email: " . $_POST["email"] . "\r\n";
    
    mail($sendTo, $subject, $message, $headers);
     
    ?>
    Which part do i need to remove to stop this from happening...

    "Started listening to Phil last week. Very Good.Message: Started listening to Phil last week. Very Good.
    Name: mark
    Email: sutty.mark@blueyonder.co.uk"

    As you can see i get the message twice. Ive been trying to remove stuff with varying degrees of success. I bet its really obvious but i just cant see it. Sorry..

    Many thanks in advance.

    Greg

  2. #2
    602
    posts
    Backend Specialist
    Try changing your $message variable to $msg or something. Just something over than your POST variable.

  3. #3
    Replace:
    Code:
    $message .= "Message: " . $_POST["message"] . "\r\n";
    With:
    Code:
    $message = "Message: " . $_POST["message"] . "\r\n";

  4. #4
    Hi Skoob and Tchuki

    Thanks for your help, I'll give it a go now.

    Greg

  5. #5
    Hi guys,

    I'm afraid neither of those worked, Ive tried

    HTML Code:
    $msg .= "Message: " . $_POST["message"] . "\r\n";
    and
    HTML Code:
    $message = "Message: " . $_POST["message"] . "\r\n";
    any other ideas??

  6. #6
    Hi again,

    SOrry Im a big fat idiot! changed the wrong variable didnt I!!

    so this is how it looks now thanks to you and is working fine

    HTML Code:
    <?php
    
    $sendTo = "g_rochford@yahoo.co.uk";
    $subject = "Contact Form";
     
    $headers = "From: " . $_POST["email"] . "\r\n";
    
    $headers .= "Reply-To: " . $_POST["email"] . "\r\n";
    
    $headers .= "Return-path: " . $_POST["email"];
     
    $message .= "Message: " . $_POST["msg"] . "\r\n";
    $message .= "Name: " . $_POST["name"] . "\r\n";
    $message .= "Email: " . $_POST["email"] . "\r\n";
    
    mail($sendTo, $subject, $message, $headers);
     
    ?>
    thanks for all your help again!

    Greg

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012