I.
I'm new at PHP and I'm having a few problems.
I'm trying to do a tell a friend script but the user must complete the form in a popup window. I've used javascript to open the popup window, but the popup window don't catch the HTTP_REFERER from the main window.
The main window code to call the popup window:
<a href="/alfa/php/friend.php" onclick="window.open('http://www.domain.com/alfa/php/friend.php', 'Tell a Friend', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=360');"><br>
Tell a Friend</a>
the friend.php code is
<?
if($submit){
mail($friend_email, "subject", $message,
"From: [email]info@domain.com[/email]\r\n"
."Reply-To: $sender_mail\r\n");
echo("Your sugestion was sent!!<br>");
}
else{
?>
<form method="post" action="<?php echo $PHP_SELF?>">
<table>
<input type="hidden" name=page_url value=<?echo $HTTP_REFERER?>>
<tr> <td>Your name</td> <td><input type="Text" name="sender_name"> * </td></tr>
<tr> <td>Your email</td> <td><input type="Text" name="sender_email"> *</td></tr>
<tr> <td>friend name</td> <td><input type="Text" name="friend_name"> * </td></tr>
<tr> <td>Friend Email</td> <td><input type="Text" name="friend_email"> *</td></tr>
<tr> <td>Message</td> <td><textarea name=message></textarea></td></tr>
<tr> <td></td> <td><input type="Submit" name="submit" value="Enviar Sugestão" target="<?$page_url?>" ></td></tr>
<?
$message = "I $friend_name\n\nYour friend $sender_name send you this page.\n
.$page_url."\n
I've tried to pass the HTTP_REFERER when calling friend.php with ]<a href="/alfa/php/friend.php?page_url=$HTTP_REFERER" but this didn't work.
I've also tried to do this in a normal page, but when redirecting the users (using javascript) to the page when friend.php was called, he returns to friend.php again!!
I hope that someone can help me.
Thanks