Wrox Programmer Forums
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 12th, 2006, 03:31 AM
Registered User
 
Join Date: Apr 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default session

but my problem is not just handling.i have to display it on website every last page the user visited and a link to go back to any of the page .plz help

 
Old April 18th, 2006, 10:46 AM
Authorized User
 
Join Date: Mar 2004
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The easier way would be to use JavaScript instead.

This would generate the link:
Code:
<a href="javascript:history.go(-1)">Go back</a>
If only the user's browser supports JavaScript and it is not disabled, this will work. Besides this would work also for non-PHP pages like HTML.

If you really want to save the URL in the session variable, you can do this.

Code:
#    Read the last page:

$sLastPage = $_SESSION ['sLastServer'] . $_SESSION ['sLastScript'];
$sBack = "<a href='$sLastPage'>Go back</a>";

#    Store the current page into the session array:

$_SESSION ['sLastServer'] = $_SERVER ['SERVER_NAME']  #    For example,    www.yoursite.com
$_SESSION ['sLastScript'] = $_SERVER ['SCRIPT_NAME']  #    For example,    /news/article.php
$_SESSION ['sLastRequest'] = $_SERVER ['REQUEST_URI'] #    For example,    /news/article.php?no=123
You just have to think what to display in the virst visit.

Janis






Similar Threads
Thread Thread Starter Forum Replies Last Post
session komalpriya .NET Framework 2.0 4 October 30th, 2007 09:16 AM
session lakshmi devi Classic ASP Basics 4 July 20th, 2006 04:33 AM
session and cookie problem (empty session file) msincan BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 February 27th, 2005 05:31 PM
session help -Dman100- Classic ASP Basics 1 November 29th, 2004 12:45 AM
About Session mani_he Beginning PHP 7 September 18th, 2004 03:47 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.