shadiadiph Posted December 22, 2008 Share Posted December 22, 2008 silly question how do you make the browser go back to the previous page in php? header('Location: adfile.php'); is it better to use javascript? Quote Link to comment https://forums.phpfreaks.com/topic/138061-header-location-back/ Share on other sites More sharing options...
ngreenwood6 Posted December 22, 2008 Share Posted December 22, 2008 if you are only able to get to that page from one page I would just make the location the page that would be back otherwise you would have to use javascript. Quote Link to comment https://forums.phpfreaks.com/topic/138061-header-location-back/#findComment-721639 Share on other sites More sharing options...
shadiadiph Posted December 22, 2008 Author Share Posted December 22, 2008 if it just went back to the same page any previous data would be lost? Quote Link to comment https://forums.phpfreaks.com/topic/138061-header-location-back/#findComment-721663 Share on other sites More sharing options...
ngreenwood6 Posted December 22, 2008 Share Posted December 22, 2008 If you are referring to them filling out a form then yes. Google javascript back or something and you should be able to find and answer or ask in the javascript section. Quote Link to comment https://forums.phpfreaks.com/topic/138061-header-location-back/#findComment-721665 Share on other sites More sharing options...
premiso Posted December 22, 2008 Share Posted December 22, 2008 if it just went back to the same page any previous data would be lost? Potentially, but if you use javascript it would potentially duplicate the data. IMO the best way is to use sessions to set the previous_page and then use that for the header location. This will not duplicate data, but wipe it out unless you store the data in session and use that to re-populate the form. Quote Link to comment https://forums.phpfreaks.com/topic/138061-header-location-back/#findComment-721669 Share on other sites More sharing options...
shadiadiph Posted December 22, 2008 Author Share Posted December 22, 2008 thanks guys thats what i thought cheers this image upload thing i was doing yesterday is still killing me with the header loacation not working so i am restructuring the whole thing. Quote Link to comment https://forums.phpfreaks.com/topic/138061-header-location-back/#findComment-721682 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.