Session variable
Posted: Wed Feb 29, 2012 9:08 pm
I have file file1.php that when it is run i would like to based on some condition i would like to define
global variable or constant that will be visible in file2.php. File2.php includes file1.php.
I tried to accomplish this with session for example like this.
file1.php
File2.php
But output i get is MYCONST
i first run file1
Then on press of the button i run file2.php
Can anyone suggest what i am doing wrong please
global variable or constant that will be visible in file2.php. File2.php includes file1.php.
I tried to accomplish this with session for example like this.
file1.php
Code: Select all
<?php
session_start()
If (something){
define('MYCONST',5);
}
Else {
define ('MYCONST',6);
}
Code: Select all
Include file1.php
Session_start();
Echo MYCONST;
i first run file1
Then on press of the button i run file2.php
Can anyone suggest what i am doing wrong please