Hi all...

i have 3 pages .....
in the first page i have started the session......i want the values from the first page, second page and finally it has to be stored in the last page......
i want the tag for session start and how should i store the values in the session......pls help me out..........

Recommended Answers

All 9 Replies

You just write the piece of code in the starting of page:

session_start();

And write the below code where ever you want to store your session variable:

session_unregister('mysesvar');
session_register('mysesvar');
$_session['mysesvar']=your value;

And retrieve your session variable where ever you want by using this:

$_session['mysesvar'].

session_start();
session_unregister('mysesvar');
session_register('mysesvar');
$_session=your value;

see i have variables like username,password,emailid,etc in first page.......
and in the next page i have the selection option......based on the selected item list of values will be displayed in the 3rd page......after selecting some values in this page...we have to submit..........

session_register('username');
session_register('emailid');
like this i will write in the second page after that what should i do............pls explain me in detail.....

You mentioned username , password,email are your variables...
I think if you provide a login page, you should have that data in your database, then why should you put password and email in sessions.

First you have to put your username in sessions like:

session_unregister('username');
session_register('username');
$_SESSION['username'']=$_POST['username'];

Then you can use the $_SESSION variable where ever you want...

or

Tel what is purpose of using session in third page..
Please confirm is that data in your database or not?

yes i have login page.......with those fields i have some more fields in the first page
and he has to select some of the services available in second page. after that he has to register......so i did it without session........nothing was storing in db.

you mentioned, in third page the user will go to register..without a registration how he will login in the first page...
I think you are in confusion what you want to develop,first clear that and go...
ALL THE BEST...

ya i am clear.........this is all registration process after successfull registration only...
he can login..........
ok thanks .........if i have any doubts ...............i will ask

k...

Hi i'm getting this error............
Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0

i never saw this error....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.