fraser5002 Posted February 5, 2011 Share Posted February 5, 2011 Hi , I have a login page that i acces via www.mydomain.com/logib.php?last_visited_page.php however the passed in variable last_visited_page.com is not always set . once the login script has run , when the variable it is not set i would want jump to myaccount.php otherwise jump to last_visited_page.php How do i check for no variable beinf present and therefore jump to myaccount.php Many Thanks Fraser Link to comment https://forums.phpfreaks.com/topic/226792-check-for-variable-in-url/ Share on other sites More sharing options...
PaulRyan Posted February 5, 2011 Share Posted February 5, 2011 To work this correctly you should have the url as something like mydomain.com/login.php?last=lastPage.php... Then you can use the following to check if it exists and if so to use it. <?PHP if(isSet($_GET['last'])) { $lastPage = $_GET['last']; } else { $lastPage = 'myaccount.php'; } ?> Obviously you may have to do some more checks to make sure the data is correct and valid, but that should give you a start Regards, PaulRyan. Link to comment https://forums.phpfreaks.com/topic/226792-check-for-variable-in-url/#findComment-1170268 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.