473,386 Members | 1,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Session problem (var not registred)

Hi

I've the following problem:

Script 1 (sess2.php):
<?php
session_start();
session_register('myReg');
$myReg = "Hello";
header("Location: test.php",FALSE);
exit();
?>

Script 2 (test.php):

<?php
session_start();
$mySessId = session_id();
echo "SessId_Test = $mySessId <br>";
$value = $_SESSION['myReg'];
echo "myReg = $value <br>";
?>

If i invoke sess2.php the first time (in a new browser) i receive the
following result:

SessId_Test = a729c9ae3dc91a0b25b41ab4ab492216
myReg =

if i invoke sess2.php the second time (in the same browser) :

SessId_Test = a729c9ae3dc91a0b25b41ab4ab492216
myReg = Hello

Have someone an idea, why the session var is only the second time available?

Regards, Michael

Jul 16 '05 #1
2 2017
Wednesday 30 of July 2003 12:59, frimi wrote in comp.lang.php:
Script 1 (sess2.php):
<?php
session_start();
session_register('myReg');
$myReg = "Hello";
header("Location: test.php",FALSE);
exit();
?>


You have it the other way round - first: $myReg = "hello" then
session_register ...

regards!

-robert-
--
Robert Jirik
[mailto:robert(at)aristoteles(dot)xhaven(dot)net]
public PGP key: http://xhaven.net/robert/pgp_key.asc
-
"Whenever you find yourself on the side of the majority,
it's time to pause and reflect"
-- Mark Twain

Jul 16 '05 #2
Hi Robert

I've changed the statement sequence => same effect (@#*%... ) !?

Thanks, Michael
"Robert Jirik" <ro****@aristoteles.xhaven.net> schrieb im Newsbeitrag
news:bg**********@news.nextra.cz...
Wednesday 30 of July 2003 12:59, frimi wrote in comp.lang.php:
Script 1 (sess2.php):
<?php
session_start();
session_register('myReg');
$myReg = "Hello";
header("Location: test.php",FALSE);
exit();
?>


You have it the other way round - first: $myReg = "hello" then
session_register ...

regards!

-robert-
--
Robert Jirik
[mailto:robert(at)aristoteles(dot)xhaven(dot)net]
public PGP key: http://xhaven.net/robert/pgp_key.asc
-
"Whenever you find yourself on the side of the majority,
it's time to pause and reflect"
-- Mark Twain

Jul 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Karen | last post by:
Hi there.... i got a quick one for you guys. i've this session variable that is updated by calling a server method (i set this value when the user hits a submit button in my form. The server...
6
by: -D- | last post by:
I'm trying to accomplish the following. I'm trying to get the values for the table rows that are dynamically created to persist through a redirect. Referring URL:...
2
by: Eric | last post by:
Hi, I've a problem with trying to retrieve a session variable in an include file. Basically, the main asp creates a session variable: <% Session("var1") = "Hello" %> And then when I click...
1
by: samtran331 | last post by:
Hi all I've got a .Net site that has 3 session variables...the variables should persist over 23 unique insert pages, 23 update, and 23 "view total" pages... And the problem is once I get past one...
6
by: Jon | last post by:
If a session times out, but the forms auth is still logged in it's possible for users to go to pages on the site that need those session variables. I was under the impression that using forms auth...
10
by: thomson | last post by:
Hi, i create a session variable in C# as follows Session , but iam not able to access the variable in VB.net like intmode=Session("var"); Why is that ? Regards
7
by: Mr Newbie | last post by:
I have written a Custom Control Menu. Its fairly simple but it works well enough. In order to simplify things I decided to store the Menu1 custom control in Session. In the page load event below,...
2
by: Frank | last post by:
Can I do this? I add a session var in C# and ultimatly want to pass it into a vbscript client side activeX control. This is what I have so far but get " Object Required:'name2' " error. Can...
1
by: zzzbla | last post by:
Hello, I have a project in which I'm trying to embed one site, that uses session stored variables, inside an IFRAME in another site (which for that matter doesn't even use sessions). Problem...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.