I have a referral script that is not working.
The script is suppose to refer a url, which has a "&" in it.
When the script is used, it refers everything behind the URL, but the & and the remaining URL is lost.
Is there something I need to change to this part of this script to accommodate the url string to work when sent? Can I make a simple change to the <script> below?
This is what it shows in emails:
http://www.website.com/category.cgi?Show_Item
This is what it SHOULD show:
http://www.website.com/category.cgi?Show_Item&1064588705
This is the link the user would click on:
<script language="JavaScript">
queryVar = this.location.href;
document.write("<a href=http://www.website.com/refer/index.php?url=" + queryVar + ">Click here to send this page to someone!</a>");</script>
Here is the actual scripts.........
=============
sendlink.php file:
<html>
<head>
<title>Send This To A Friend</title>
</head>
<body bgcolor=FFA500>
<center>
<font face=verdana>
<table width=750 cellpadding=5 border=0 bgcolor=FFFFFF>
<tr>
<td align=center valign=top>
<table width=90% border=0 cellpadding=5>
<tr>
<td valign=top>
<form name="form1" method="post" action="send.php">
<br>
<center><p><h2>Send This Item To A Friend</h2>
</p></center>
<p><font face="Arial, Helvetica, sans-serif" size="2">Do you know someone that might like this? Here is the easy way to do it! Simply fill in the e-mail address of the person you wish to tell about the page, your name and e-mail address, and click the 'send' button. If you want to, you can also enter a message that will be included with the e-mail.</font></p>
<p><font face="Arial, Helvetica, sans-serif" size="2">Just for your information, there is no need to worry! We do not collect your email addresses or the person you are sending the information to. This is simply a way for you to send yourself about an article or tell a friend about what you found.
</font></p>
<table border="0" cellspacing="1" cellpadding="2" align="center">
<tr>
<tr>
<td>
<div align="right"><font face="Arial, Helvetica, sans-serif" size="2"><b>Friend's
Name</b></font></div>
</td>
<td> <font face="Arial, Helvetica, sans-serif" size="2">
<input type="text" name="friend_name" size="25">
</font></td>
</tr>
<tr>
<td>
<div align="right"><font face="Arial, Helvetica, sans-serif" size="2"><b>Friend's
Email</b></font></div>
</td>
<td> <font face="Arial, Helvetica, sans-serif" size="2">
<input type="text" name="friend_email" size="25">
</font></td>
</tr>
<td>
<div align="right"><font face="Arial, Helvetica, sans-serif" size="2"><b>Your
Name</b></font></div>
</td>
<td> <font face="Arial, Helvetica, sans-serif" size="2">
<input type="text" name="your_name" size="25">
</font></td>
</tr>
<tr>
<td>
<div align="right"><font face="Arial, Helvetica, sans-serif" size="2"><b>Your
Email</b></font></div>
</td>
<td> <font face="Arial, Helvetica, sans-serif" size="2">
<input type="text" name="your_email" size="25">
</font></td>
</tr>
<tr>
<td>
<div align="right"><font face="Arial, Helvetica, sans-serif" size="2"><b>Your
Message</b><br>
(optional)</font></div>
</td>
<td> <font face="Arial, Helvetica, sans-serif" size="2">
<textarea name="message" cols="25"></textarea>
<input type="hidden" name="url" value="<?php echo $url; ?>">
</font></td>
</tr>
<tr>
<td>_</td>
<td> <font face="Arial, Helvetica, sans-serif" size="3">
<input type="submit" name="Submit2" value="SEND">
</font></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
</center>
</font>
</body>
</html>
=============
send.php
<?php
$to = "$friend_name <$friend_email>";
$from_header = "From: $your_name <$your_email>";
$subject = "$your_name recommendeds this item to you";
$body = "Hi $friend_name \n\n";
$body .= "$your_name has suggested you visit this webpage soon and take a look the following URL:\n\n";
$body .= "<<< ($url) >>>\n\n";
$body .= "Please copy the above URL and paste it into your address bar if the entire website address is not underlined. \n\n";
$body .= "Here is a personal message from $your_name.... \n\n--------------------------------------\n$message\n--------------------------------------\n\n";
$body .= "Thank you!\n\n";
mail($to, $subject, $body, $from_header);
?>
<html>
<head>
<title>Send This To A Friend</title>
</head>
<body bgcolor=FFA500>
<center>
<font face=verdana>
<table width=750 cellpadding=5 border=0 bgcolor=FFFFFF>
<tr>
<td align=center valign=top>
<table width=90% border=0 cellpadding=5>
<tr>
<td valign=top align=center>
<p><b><font face="Arial, Helvetica, sans-serif" size="5">Your message has been sent!</b></font>
<br>
<br>
</td>
</tr>
</table>
</center>
</font>
</body>
</html>
Now, this works great for regular urls, but since I have an "&" sign in the url, it chops it off in the url string in the email that is sent to the referred person.
Is there a way to change the script to accommidate the & sign in the url?
OR, is there a free script out there (not remotely hosted) that would do the same thing?
Thank you for taking time to look at this and providing suggestions. I have been told to use the GET method and some variables, but I have no clue as how to put them in with the code.
David