PHP Session Variables
Moderator: General Moderators
-
TheFisherman
- Forum Newbie
- Posts: 8
- Joined: Fri Nov 14, 2003 6:43 pm
- Location: Plano, Texas
PHP Session Variables
I am new to PHP and cannot find out how to use session variables like I am used to in ASP. Any help would be appreciated.
-
Paddy
- Forum Contributor
- Posts: 244
- Joined: Wed Jun 11, 2003 8:16 pm
- Location: Hobart, Tas, Aussie
- Contact:
Seeing as you know ASP you probably just want the syntax for using sessions?
Would print blah to the screen. Placing session_start(); at the top of any php file would mean that $anothervar = $_SESSION['somevar']; would work in it as long as somevar has been set prior.
Hope that helps.
Code: Select all
<?php
session_start();
$_SESSION['somevar'] = "blah";
$anothervar = $_SESSION['somevar'];
echo ($anothervar);
?>Hope that helps.
-
TheFisherman
- Forum Newbie
- Posts: 8
- Joined: Fri Nov 14, 2003 6:43 pm
- Location: Plano, Texas