Passing the page URL using a hidden field is the safest way to do it.
You could use $_SERVER['HTTP_REFERER'], but as zippee mentioned, not all browsers pass the info. You could just simple test it for a value. If a value exists, display the Continue Shopping button with the link. If it doesn't exist, don't display the button.
My main business is SEO. IMHO, you shouldn't pass values in the URL like that if you are using hyperlinks. It creates multiple URLs that all represent the same page, which is guaranteed to cause problems with duplicate content penalties with the search engines. You could overcome those issues by either adding the proper meta tags to the cart page to prevent the indexing and archiving of the page, or by adding the rel="nofollow" attribute to the hyperlink, or by using a form button to link to the cart.
Last edited by TopDogger; Sep 17th, 2006 at 12:31 pm.
Reputation Points: 15
Solved Threads: 5
Junior Poster in Training
Offline 87 posts
since Aug 2005