Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 08-07-2006, 09:33 PM   #1 (permalink)
 
True Techie

Join Date: May 2006

Location: Chicago IL

Posts: 104

thejeremy

Send a message via AIM to thejeremy
Default Learning PHP

Here's the structure of my program.

A user will login (login.php), they will read some instructions (instructions.php), and they will finally be directed to answer some questions in a step by step survey (questions.php). My question is, how can I access variables that were entered back in login.php, such as username or email address for example, when the user has already left that page? I need to insert the answer from each question into the database as it is entered, and I need to locate the current user's table entry and access the MySQL database to do so. Is there some global variable type I can initiate to hold these values? I'm sorry if this is a noob question, I'm still learning.

Help is appreciated.
__________________
CPU: AMD Athlon 64 X2 5200+ Windsor, 2.6 GHz
RAM: CORSAIR XMS2 2GB 240-Pin DDR2
VIDCARD: EVGA PCI-Express x16 GeForce 7900GS 256MB
MOBO: ASUS M2N-SLI Deluxe AM2
HDD: Seagate Barracuda 320GB 7200 RPM SATA

my blog: http://jspot.gotdns.com
thejeremy is offline  
Old 08-08-2006, 03:15 PM   #2 (permalink)
 
Monster Techie

Join Date: Apr 2005

Posts: 1,909

jcortes is on a distinguished road

Send a message via AIM to jcortes
Default

you need to set them as session veriables and start a session in each page you will be using them. at the top of each page the global veriables will be used, session veriables, you will need to start the session like so <?php session_start(); ?> than back at the page that you first get the username and email you will transfer those into session veriables by declaring them like this

$_SESSION['username'] = $username;
$_SESSION['email'] = $email;

and you will then from then on when needed call them as $_SESSION['username'];. starting the session on each page is very important though or it will not work even the best of us forget this step sometimes.

hope that helps
__________________

AIM = jcortestechhelp
jcortes is offline  
Old 08-08-2006, 03:23 PM   #3 (permalink)
 
True Techie

Join Date: May 2006

Location: Chicago IL

Posts: 104

thejeremy

Send a message via AIM to thejeremy
Default

i was just readin about $_SESSION variables before you posted. this looks like it'll do what I need...thnx for comin through for me

If I have more PHP questions I'll just tack em on to the end of this thread.
__________________
CPU: AMD Athlon 64 X2 5200+ Windsor, 2.6 GHz
RAM: CORSAIR XMS2 2GB 240-Pin DDR2
VIDCARD: EVGA PCI-Express x16 GeForce 7900GS 256MB
MOBO: ASUS M2N-SLI Deluxe AM2
HDD: Seagate Barracuda 320GB 7200 RPM SATA

my blog: http://jspot.gotdns.com
thejeremy is offline  
Old 08-08-2006, 03:32 PM   #4 (permalink)
 
Monster Techie

Join Date: Apr 2005

Posts: 1,909

jcortes is on a distinguished road

Send a message via AIM to jcortes
Default

ok no problem just ask me ill be here i have lots of experience with php good luck.
__________________

AIM = jcortestechhelp
jcortes is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On