Referrer url not working
Posted: Mon Feb 02, 2004 2:43 pm
This is my 404 page for my site. I want to be able to send myself some information. The email is sent fine but I want to include the referrer page. So like if a user came to the 404 page from a_page.php then it would tell me "a_page.php". The code below is the code I have so far. I also wanted it to be able to output either a read only input box or a text based on whether or not the refferer page variable is blank or not. If it is blank then I want it to let the user enter something. If it is not blank then I just want it to tell the user the referrer page. Can someone please help me? If you have any questions about what I'm trying to do here feel free to reply here or contact me. Thanks.
Code: Select all
<?php
if(isset($mailform)) {
mail("MYEMAIL", "404 Error", "Comment: $comment \n\n URL 1: $refer \n\n URL 2: $refer2 \n\n IP: $REMOTE_ADDR \n\n Browser: $HTTP_USER_AGENT \n\n", "From: form");
echo "<BR><BR><BR>Thank you.";
}
else {
echo "<center><BR><BR><BR></center><p>Please fill out the form here if you got here by a link.
<form method=POST action='404error.php'>
<table>
<tr><td>URL with link:</td><td>";
if($HTTP_REFERER=""){echo "<input type='text' value='' name='refer2'>";}
else{echo "<input type='hidden' name='refer' value='$HTTP_REFERER' >$refer";} echo "</td></tr>
<tr><td>Comment:</td><td><textarea rows=4 cols=24 name='comment' maxlength=400></textarea></td></tr>
<input type='hidden' name='mailform' value='iamset'>
<tr><td></td><td><input type='submit' value='Submit'></td></tr></table>
}
?>