Good one for you. For the PHP experts. Sending an email with this script?

well well well

New member
This is a php redirection script and our librarians would like to track every time a redirection is used by "receiving an email" LOL.

I'm a beginner in php and I tried a foreach loop, but that ended terribly wrong. :-) It ended up with somebody knocking repetedly on both my back and front door in a loop.

We really need this script to be able to send an email with "m" variable value (see script below) as the "subject" and the referral url in the "body" every time any redirection link is used/clicked. Below is the redirection php script code that I have so far:

<?PHP

/* This script name is jump.php

<a href="jump.php?m=XXXXXX">XXXXXX</a>
XXXXXX is the target link.
*/


$m = $_GET['m'];

if ($m == "") {$link = "http://www.externalsite.com/library.html";} // Default Blank
if ($m == "Abraham-L") {$link = "http://www.externalsite.com/abraham-lincoln.html";}
if ($m == "Washington") {$link = "http://www.externalsite.com/washington.html";}

header("Location: $link");
exit();
?>

So basically I need:

- When a link is clicked, an email is fired up with the "m" variable value in the subject and the referral url in the body.

Hey experts, we'd really appreciate if you could help us here. I know this is a very simple task for you guys. I just can't get it after working on it for 2 days due to my inexperience now! Thanks in advance for any help you can provide.
Colanth, thanks for your suggestion. This is an internal redirection script and no user should see messages displayed. They just click on the link and land on external site. I see you included "echo"? Also you forgot to include the referral url in the body? Thanks for any other suggestions
 
Back
Top