Jump to content

Check for Variable in URL


fraser5002

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.