using a variable defined in one php file in another php file

76 Views Asked by At

In my adminpage.php I have two hyperlinks which displayed asoption1 ,option2. What I want is when Admin selects option1 it directs to a page named as adminOption1.php and in this page I want to set in a variable, say named as 'adminType' ($adminType=option1) so that I can use the variable adminType in a different php file say, adminDisplay.php. So that in adminDisplay.php based on whether adminType is set to option1 or option2 I can view different outputs.This admin's options are not stored in the database, it solely depends on the link which he clicks.

Can I set this as a session variable? I have my sessions as,

$sql=mysql_query("SELECT * FROM member WHERE `userName`='$n' AND password`='$p'");

if(mysql_num_rows($sql)==1) {
    $_SESSION['user']=mysql_fetch_array($sql);

and my member table has only id, name and userName as fields. How can I do this.

0

There are 0 best solutions below