roldahayes Posted January 5, 2009 Share Posted January 5, 2009 Hi there, I'm using this code for a "continue shopping" button <?php echo $_SESSION['returnTo']; ?> Works ok, but it always returns the previous page back at the top of the screen. is there a way to get it to return to the place on the page that it started on? Link to comment https://forums.phpfreaks.com/topic/139527-better-code-for-this-back-button/ Share on other sites More sharing options...
krishna.p Posted January 5, 2009 Share Posted January 5, 2009 Could you be more specific? Thanks, Krishna.p Link to comment https://forums.phpfreaks.com/topic/139527-better-code-for-this-back-button/#findComment-729861 Share on other sites More sharing options...
roldahayes Posted January 5, 2009 Author Share Posted January 5, 2009 Ok, if you go here.... http://www.autorack.co.uk/results.php?make=FORD+---------------+van+products&model=TRANSIT--2000-on++Standard+Low+Roof+Models&submit3=Click+here+to+search. scroll down the page and click any buy button. When you click "continue shopping" it goes back to the results page but at the top, not where you originally left the page. I fixed it using "javascript: history.go(-1)" but wondered if there was a better, PHP way of doing in incase someone has java turned off. Link to comment https://forums.phpfreaks.com/topic/139527-better-code-for-this-back-button/#findComment-729866 Share on other sites More sharing options...
l_kris06 Posted January 5, 2009 Share Posted January 5, 2009 <?php $back = $_SERVER['HTTP_REFERER']; //contains absolute url $back = basename($back); //contains filename(eg.viewCart.php) you can manipulate this to acheive wht you want. Hope this helps. Rgds, Kris Link to comment https://forums.phpfreaks.com/topic/139527-better-code-for-this-back-button/#findComment-729912 Share on other sites More sharing options...
roldahayes Posted January 5, 2009 Author Share Posted January 5, 2009 Thanks for the reply, but I'm not sure how to implement that into a standard basket.php button that needs to return back to the referring page that could be anything? Link to comment https://forums.phpfreaks.com/topic/139527-better-code-for-this-back-button/#findComment-729920 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.