Forum Moderators: coopster
I hope someone can help me with this issue as I've search and cannot find an answer.
I have a basic contact form that works fine, what I need to add is the ability to see what website the visitors came from. Here is the form code as of now:
<form name="form2" method="post" action="contact.php">
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr>
<td width="50%"><div align="left"><strong>Name <br>
<input name="Name" type="text" class="form" id="Name">
<br>
Email <br>
<input name="Email" type="text" class="form" id="Email">
<br>
Phone<br>
<input name="Phone" type="text" class="form" id="Phone">
<br>
Comments</strong><br>
<textarea name="Comments" cols="50" rows="5" class="textarea" id="Comments"></textarea>
<br>
<input name="Reset" type="reset" class="submit" value="Reset">
<input name="Submit2" type="submit" class="submit" value="Submit">
<br>
<br>
</div>
</td>
</tr>
</table>
<br>
<br>
<span style="margin-left:8px; width:147px "><strong>114 Front Street <br>
City, ST 12345 <br>
Tel./Fax number deleted<br>
<a href="mailto:email@domain.com">email@domain.com</a></strong></span>
</form> Thanks for any help with this!
$_SERVER['HTTP_REFERER']
you are looking for.
For more info see
[php.net...]
but remember, that this variable isn't always acurate, cause many browsers don't send that information.
Regards
Michal Cibor
You could add something along the lines of this untested pseudocode in your global include file:
$_SESSION['last_five_pages'][] = $_SERVER['REQUEST_URI'];
if(count($_SESSION['last_five_pages']) > 5){
// prune the oldest entry
$oldest_entry = array_shift($_SESSION['last_five_pages']);
}
[edited by: whoisgregg - Wed, 03 Jan 2007 18:50:25 GMT] Whoops, messed up a big detail, should be better now but it's still untested code and needs improvement.