Results 1 to 2 of 2

Thread: Problem identifying mailer.php messages

  1. #1

    Problem identifying mailer.php messages

    Hello All,
    I'm a first time poster so I feel a bit awkward asking for help on my first post.
    I've been searching to try and find, probably what is a very simple fix to my mailer.php form. I'm using the mailer form to create a simple booking form. As such each mailer form will be on a different page i.e
    one mailer on page bookforfriday.html, the same mailer on bookforsaturday.html etc etc. I have the problem that my mailer doesn't tell me from which webpage the message was sent (which would solve my problem) so I get lots of booking but no idea for what day.
    I'm looking to move this across from weebly (because it's getting too big) but the weebly contact form told you from which webpage the mailer was sending from.
    Am I missing something simple here? My current mailer looks like this:

    <?php

    $to = "abc@abc.com";
    $subject = "Booking form";
    $headers = "From: (ENGLAS) www.abc.com";
    $forward = 1;
    $location = "http://www.abc.com/request.html";

    $date = date ("l, F jS, Y");

    $msg = "Below is the result of your contact form. It was submitted on $date at $time.\n\n";

    $name = $_REQUEST['Full Name'];
    $email = $_REQUEST['Email Address'];
    $subject = $_REQUEST['Subject'];
    $message = $_REQUEST['Message'];

    if ($_SERVER['REQUEST_METHOD'] == "POST") {
    foreach ($_POST as $key => $value) {
    $msg .= ucfirst ($key) ." : ". $value . "\n";
    }
    }
    else {
    foreach ($_GET as $key => $value) {
    $msg .= ucfirst ($key) ." : ". $value . "\n";
    }
    }

    mail($to, $subject, $msg, $headers);
    if ($forward == 1) {
    header ("Location:$location");
    }

    ?>

    Any help or suggestions will be gratefully received,
    Simon

  2. #2
    You can use the HTTP_REFERER variable in PHP that contains the refering page.

    example:
    PHP Code:
    $referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';//<--added line
    $msg .= " referer: $referer \n";//<--added line
    mail($to$subject$msg$headers); 

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