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
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
Link to comment
Share on other sites

[quote author=mehole link=topic=104852.msg418610#msg418610 date=1156014899]
Ok I have tried using the HTTP_REFERER code but I'm now getting an error and i'm not sure what is wrong? [/quote]

Care to share what the error actually is?
Link to comment
Share on other sites

[quote]Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, support@supportwebsite.com 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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.