...

View Full Version : Resolved Setting a session to hold a value



masterofollies
03-07-2009, 03:01 PM
I forgot how to put a value into a session to hold over multiple pages.

Like you are editing user ID 104. So 104 needs to be the value in the session so I can query the ID and update as needed. It was something like this?


$keepid = SESSION['id'];

kokjj87
03-07-2009, 03:17 PM
session_start();
$_SESSION['id'] = $keepid;

masterofollies
03-07-2009, 04:31 PM
Thats for a form?

Like:

<input type="text" name="myname" value="">

and after the isset. Do this?


$keepname = $_POST['myname'];
$_SESSION['myname'] = $keepname;

So then I can pull the session like this?


echo "My name is ".$_session['myname']."";

_Aerospace_Eng_
03-07-2009, 04:40 PM
Yes if you have session_start(); at the top of your code.

masterofollies
03-07-2009, 10:19 PM
Ok thanks



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum