Hagbard Posted April 24, 2008 Share Posted April 24, 2008 is there any way in the header file to have the page go back two pages header ("location: index.php"); - will take you back to index and I know if I make an input button it can go back a page <input type=button value=\"Go Back to List\" onClick=\"history.go(-1)\"> | "; but is there any way to combine the two so that it will automatically go back a page? Link to comment https://forums.phpfreaks.com/topic/102728-solved-history-header/ Share on other sites More sharing options...
JasonLewis Posted April 24, 2008 Share Posted April 24, 2008 Not sure with PHP. But you can do it with Javascript. <body onload="javascript: history.go(-1)"> From memory... Link to comment https://forums.phpfreaks.com/topic/102728-solved-history-header/#findComment-526059 Share on other sites More sharing options...
ryanhowdy Posted April 24, 2008 Share Posted April 24, 2008 try this header("Location: ".$_SERVER[HTTP_REFERER]); Link to comment https://forums.phpfreaks.com/topic/102728-solved-history-header/#findComment-526061 Share on other sites More sharing options...
JasonLewis Posted April 24, 2008 Share Posted April 24, 2008 Thats back one page, not two... You wanted to go back two right? So not the last page you were at but the page before? Link to comment https://forums.phpfreaks.com/topic/102728-solved-history-header/#findComment-526064 Share on other sites More sharing options...
The Little Guy Posted April 24, 2008 Share Posted April 24, 2008 You could use sessions, then update them on every page. Link to comment https://forums.phpfreaks.com/topic/102728-solved-history-header/#findComment-526065 Share on other sites More sharing options...
Hagbard Posted April 24, 2008 Author Share Posted April 24, 2008 Yes the code will be put into a process page but I want it to go back to the page before the page that started the process. Now give me a second to reread my reply and make sure I said that right. lol But yes I need to go back 2 pages. Link to comment https://forums.phpfreaks.com/topic/102728-solved-history-header/#findComment-526178 Share on other sites More sharing options...
Hagbard Posted April 24, 2008 Author Share Posted April 24, 2008 I do have a sessions script already running. However if that came to it I could just create a separate process page for each and point it to the page I'm looking for. I have post 1 post 2 post 3 post 4 I could just create a process page for each one that points to its respected page. Link to comment https://forums.phpfreaks.com/topic/102728-solved-history-header/#findComment-526182 Share on other sites More sharing options...
DarkWater Posted April 24, 2008 Share Posted April 24, 2008 <body onload="javascript: history.go(-2)"> That'll send them back two pages in their history, which might not be too reliable (they may have visited other pages in between)...You should store the page before the page in a session variable and redirect them like that. Link to comment https://forums.phpfreaks.com/topic/102728-solved-history-header/#findComment-526183 Share on other sites More sharing options...
Hagbard Posted April 24, 2008 Author Share Posted April 24, 2008 I set up the sessions. Thank you for your help everybody! Link to comment https://forums.phpfreaks.com/topic/102728-solved-history-header/#findComment-526241 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.