View Single Post
Old 10-05-2012, 07:13 PM   PM User | #44
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,493
Thanks: 44
Thanked 438 Times in 427 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
You're confused as to what globals are.

Global values are for use in a script that may require access to a value out of its scope but within that instance of the script:
PHP Code:
$Value 'foobar';

function 
test()
   {
   print 
$Value//Error - undefined variable type message
   
}

function 
test2()
   {
   global 
$Value;
   print 
$Value//Successful
   
}

test();//Error
test2();//Success 
What you want to be using is SESSIONS. Sessions are remembered between scripts. To start or resume a session you use session_start. To store anything in the session or access a session value you use the $_SESSION array.

enter_new_pass.php:
PHP Code:
session_start(); //You MUST use this in every script that accesses a users session

$id $_GET['id'];
$uniq $_GET['unique'];

$_SESSION['id'] = $id;
$_SESSION['uniq'] = $uniq
do_new_pass.php:
PHP Code:
session_start();

$id $_SESSION['id'];
$uniq $_SESSION['uniq'];

print 
"$id, $uniq"
__________________
Please wrap your code in [php] tags. It is a sticky topic and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is offline   Reply With Quote