Jump to content

Stuck with my tell-a-friend script


mehole

Recommended Posts

Hi

I have only very recently started learning php so I am VERY VERY new to it and have not done a lot so sorry for my lack of knowledge on the topic.

I have a php scipt that allows visitors to send a page of my site to a friend, and I was hoping to use the same script for every page but there are a couple of things I don't know how to do (well there is a lot of things I don't know how to do but this is just for this script  ;) ):
Get the URL of the current page so be displayed in the email.
I tried using:
[code]$URI = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; [/code]
But when I open the email it show the url of the actual .php file, not the url of the page that the form is on.
I have been told that I need the hard code the page to fix this but im not sure how to?

Also I am having trouble sending the e-mail to multiple email addresses, I tried using semi-colons but that didn't work, usless I put the wrong thing in. Can you use the variables separated with a semi-colon or does it have to be actual email addresses?

Thank you very much for any help anyone can give me
Mike
Link to comment
https://forums.phpfreaks.com/topic/18023-stuck-with-my-tell-a-friend-script/
Share on other sites

Ok I have tried using the HTTP_REFERER code but I'm now getting an error and i'm not sure what is wrong? this is my code:
[code]<?php

$name = $_POST['name'];
$http_referrer = $_SERVER['HTTP_REFERER'];

$msg = "Hey, it's $name\n";
$msg .= "Check out this funny picture over at Mike's Joke Page\n";
$msg .= "$http_referrer\n";
$msg .= "There's also some funny videos and cool games as well\n";
$msg .= "From $name\n";

$recipient = "{$_POST['email1']};{$_POST['email2']};{$_POST['email3']};{$_POST['email4']}{$_POST['email5']};{$_POST['email6']}";
$subject = "Recommendation From A Friend...";

$mailheaders = "From: {$_POST[myemail]}\r\n";
$mailheaders .= "Reply-To: {$_POST[myemail]}\r\n";

mail($recipient, $subject, $msg, $mailheaders);

header("Location: http://www.mikesjokepage.com");
exit;
?>[/code]

Can anyone see the problem?
Thanks
Mike
[quote]Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.
[/quote]

It seems to only happen when I enter multiple email addresses, here is the link, can you see what happens when you try:
http://mikesjokepage.com/Untitled-3.html

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.