By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,014 Members | 1,020 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,014 IT Pros & Developers. It's quick & easy.

How To user sessions in php5 & iis 6.0

abdoelmasry
100+
P: 104
Hi all
i have problem while using sessions

i was working with php4 on apache with This Functions:

[PHP]session_start();
session_register("username");
$username="abdoelmasry";[/PHP]

it was working good

now
im trying to use sessions in php5 on IIS 6.0

I wanna Some Wote Help me
Why this code Not Working:

first Page:

[PHP]<?php
session_start();
$_SESSION['username']="abdoelmasry";
?>[/PHP]

Second page:

[PHP]<?php
session_start();
echo "$username";
?>[/PHP]

ThX
Mar 6 '07 #1
Share this Question
Share on Google+
2 Replies


ronverdonk
Expert 2.5K+
P: 4,258
echo "$username";
This has nothing to do with PHP 5 or IIS 6.

The username is NOT stored in $username!! What makes you think it is? You stored the username in $_SESSION['username'] so when yoiu want to display it you must do it from the spot where you saved it, i.e. the $_SESSION array.

So you command should be

[php]echo $_SESSION['username'];[/php]

Ronald :cool:
Mar 6 '07 #2

abdoelmasry
100+
P: 104
Yes U Have Real
I tried The following code as you said

first page:

[PHP]<?php
session_start();
$_SESSION['username']="abdoelmasry";
?>[/PHP]

second page:

[PHP]<?php
session_start();
echo $_SESSION['username'];
?>[/PHP]


but it still not working
i have checked the session creation path
the session exactly created but i cann't read it

i think it's some thing wrong in php.ini file

Have You any idea
Mar 6 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.