Jump to content

IF


canadabeeau

Recommended Posts

Okay I have a page index.php which has an if statement basically like this: if $var == "" then redirect else do nothing

Now it redirects to loading.php

now my question is that how do I make a session variable remember this page so when the person goes to loading.php and it does its functions as required they can be redirected back to that page, I ask becuase this action will take place on all pages in my website so yeah....

and as always thanks in advance, and this time season greetings as well :-)

Link to comment
https://forums.phpfreaks.com/topic/185747-if/
Share on other sites

Well, you can do it a few different ways. 

 

Most important part about using sessions (that a lot of people forget) is you need to tell PHP that you're USING sessions :)  At the very very very beginning of your script.  I'm not 100% sure what your logic is, but something like this might get you started.

 

<?php
session_start();

$_SESSION['var'] = $var;

if($_SESSION['var'] == ""){
// redirect
}



?>

 

Link to comment
https://forums.phpfreaks.com/topic/185747-if/#findComment-980780
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.