Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Variables around

Status
Not open for further replies.

SmileeTiger

Programmer
Mar 13, 2000
200
US
I just finished redirecting a user to a web page by using:
header("Location: studoptions.php?StudentNumber=$StudentNumber"); //Send them to the student //options screen
exit;

However I don't want the student number to show up in the URL but I still want to pass the variable to the next page. How can I do this?

Cory
 
Hi

You can use session variables. At the top of each page (referrer and referee) do:

<?php
session_register(StudentNumber); //without the $

The Student number will be remembered until the user closes the browser.

Cheers
Richard
 
you could create a session for the user, and store the student number in the session.
basically it should be something like (it all depends on you php configuration):
Code:
<?php
session_register(&quot;StudentNumber&quot;);
$HTTP_SESSION_VARS[&quot;StudentNumber&quot;] = $StudentNumber;

header(&quot;Location: studoptions.php&quot; . $SID); //Send them to the student //options screen
?>
you should go and read about sessions to make sure it works the way you want it to (
good luck :) (-:
 
Without using cookies, maybe u can encode the student number, then it shows up in the URL but it isnt readable or making any sense to anybody... mcvdmvs
-- &quot;It never hurts to help&quot; -- Eek the Cat
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top