In message <!~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAAJRp9JXiRO0qK0
[EMAIL PROTECTED]>, Leelakh
Ran <[EMAIL PROTECTED]> writes
>Hi,
>
> 
>
>Here have two pages; page1.php and page2.php.
>
> 
>
>I defiend  a variable in page1.php as $storedfrom = $_SERVER["HTTP_HOST"] .
>$_SERVER["REQUEST_URI"];
>
> 
>
>I want to access $storedfrom variable from page2.php without passing it
>through URL link.
>
> 
>
>How it can access by using session variable or global variable?

Global variables should not be used for security reasons.

Session variables are used to pass variables to ALL pages in your site -
suppose you have a membership id that you want to know about, whenever
the visitor visits any page on your site.



You should be using POST - put the variables into a form.  In the case
of the above variables, they will be probably be hidden variables.
echo "<input type='hidden' name='storedfrom' value='".
$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']."'>";


If you have to use a session, make sure that you have session_start()
before any output is sent (on both pages), then on the first page
$_SESSION['storedfrom']=$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"];
and on the second page
$x=$_SESSION['storedfrom']'


-- 
Pete Clark

Sunny Andalucia
http://hotcosta.com/Andalucia.Spain

Reply via email to