Page 1 of 1

[S] Variables and carrying them trough several php scripts

Posted: Sun Jan 25, 2004 8:52 am
by Calimero
PROBLEM
1) If I declare variables in 1.php - that's the script to which I submit the form, and start another 2.php script trough Header - command, are the variables entered in the 1.php still functional in the 2.php or do I need to declare them again, and if possible the code for that (3 Variables, no more), 2.php will query the database

Thanks ahead

Posted: Sun Jan 25, 2004 8:59 am
by AVATAr
if you want to use a variable in many pages using header.. you have to

1- you use a url like: http://www.myurl.com\page.php?variable=content
and you retreive the content use get method ($_GET variable)...

2- using sessions.. ($_SESSION). you store de variable in a variable session in page 1.php ($_SESSION['myvariable'] = value) and you retreive the value in page 2 with $_SESSION['myvariable'] (you have to session_start(); in the first line of each page.

;)