phpQuestioner Posted September 12, 2007 Share Posted September 12, 2007 I have already designed this page in HTML and all my link on this site are linked to this html page. I am trying to get the address of the page that accesses this HTML page. I tried to use a PHP/Javascript external file with HTTP_REFERER set as a Javascript variable and then use Javascript inside the HTML page to load the content of the PHP/Javascript Variable into a hidden form field. But instead of showing me the previous page that had accessed my HTML page; it just displays the HTTP_REFERER for the HTML page (the html page's address). Here is the code I used: HTML <script type="text/javascript" src="myexternalscripts.php"></script> <script language="javascript"> function loadMyVars() { document.myForm.direction.value=""+previous+""; } window.onload=function() { loadMyVars(); } </script> <form name="myForm" method="post" action="formprocessorpage.php"> <input type="hidden" name="direction"> <input type="submit"> </form> PHP/Javascript (myexternalscripts.php) <?php $referral = $_SERVER['HTTP_REFERER']; echo "var previous=\"$referral\";"; ?> Anyone know how I can use HTTP_REFERER in my HTML to display the page that last accessed my HTML page in a hidden form field? Link to comment https://forums.phpfreaks.com/topic/68984-solved-page-tracking-issue/ Share on other sites More sharing options...
phpQuestioner Posted September 12, 2007 Author Share Posted September 12, 2007 Figured It Out - Apache SSI - Got To Love It! <input type="hidden" name="direction" value="<!--#echo var="http_referer" -->"> Link to comment https://forums.phpfreaks.com/topic/68984-solved-page-tracking-issue/#findComment-346772 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.