Page 1 of 1

Session not display

Posted: Thu Sep 20, 2007 5:13 am
by inspire
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


hello Friend,

i have a problem to pass the session value to other page.
here the example


[u][b]page 1[/b][/u]

Code: Select all

<?php
//session_register('xyz');
$HTTP_SESSION_VARS['name']="xyz";
?>

<html>
<head>
<form action="page2.php" method="post">
<body>
   <input type="Submit" name="login" value="login">
   <input type="input" name="login" >
  </head>
</form>
</body></html>

Page2.php

Code: Select all

<?php
session_start();
echo $HTTP_SESSION_VARS['name'];

$name=$HTTP_POST_VARS['login'];

echo $name;
?>

I am using Php 4.0.5. Why this problem accur?? Anybody know how to solve ethe problem?.
:(


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Thu Sep 20, 2007 5:18 am
by aceconcepts
Place

Code: Select all

session_start();
at the top of page 1.

Also, you could simply declare your session variables like this

Code: Select all

$_SESSION['name']="xyz";

Posted: Sat Sep 22, 2007 12:13 pm
by nhammond
yeah that http_vars stuff is the old school php way, just need session_start(); and then $_SESSION[''];