Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.

Cheers,
Kirupa

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