473,396 Members | 2,013 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,396 software developers and data experts.

New to Sessions 2

Hi!

I started a thread app 2 weeks ago and redlied to that, but it seems
to be so low in the list, that it will not be seen.

My problem - I need to transfer the sesstion to another page?

say page1.php goes to page2.php ( <a href="page2.php") ?

So, s start_sesstion, $_SESSION["fgdf"]=fsdgdf should be readable by
the other file... how do I achive that?

WBR
Sonnich
Nov 23 '07 #1
5 1560
jodleren wrote:
Hi!

I started a thread app 2 weeks ago and redlied to that, but it seems
to be so low in the list, that it will not be seen.

My problem - I need to transfer the sesstion to another page?

say page1.php goes to page2.php ( <a href="page2.php") ?

So, s start_sesstion, $_SESSION["fgdf"]=fsdgdf should be readable by
the other file... how do I achive that?

WBR
Sonnich
Add to both pages:
session_start();

Do this before you do anything else, like creating output.
so on page1.php:

session_start();
$_SESSION["test"] = "Hi";
and on page2.php
session_start();
echo $_SESSION["test"];
// should say Hi
Regards,
Erwin Moller

PS: Make sure you have error reporting ON.
PS2: Make sure your php.ini doesn't have session_auto_start on.
Nov 23 '07 #2
jodleren wrote:
My problem - I need to transfer the sesstion to another page?
say page1.php goes to page2.php ( <a href="page2.php") ?
That's how sessions work. Data is shared between pages by default. That's
the whole point of them.

Simply call start_session() at the top of both pages, and they can share
data. (A lot of newbies think that start_session() creates a new blank
session, wiping out any old session data. It does not. Think of it as
meaning "start using the session", not "start a new session".)

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 14:20.]

It'll be in the Last Place You Look
http://tobyinkster.co.uk/blog/2007/11/21/no2id/
Nov 23 '07 #3
On Nov 23, 10:24 am, Erwin Moller
<Since_humans_read_this_I_am_spammed_too_m...@spam yourself.comwrote:
jodleren wrote:
Hi!
I started a thread app 2 weeks ago and redlied to that, but it seems
to be so low in the list, that it will not be seen.
My problem - I need to transfer the sesstion to another page?
say page1.php goes to page2.php ( <a href="page2.php") ?
So, s start_sesstion, $_SESSION["fgdf"]=fsdgdf should be readable by
the other file... how do I achive that?
WBR
Sonnich

Add to both pages:
session_start();

Do this before you do anything else, like creating output.
so on page1.php:

session_start();
$_SESSION["test"] = "Hi";

and on page2.php
session_start();
echo $_SESSION["test"];
// should say Hi

Regards,
Erwin Moller

PS: Make sure you have error reporting ON.
PS2: Make sure your php.ini doesn't have session_auto_start on.
Thanks, I got it to work. Toby's explanation cleared things up.

Erwin, ma vist tunnen sind. Kas sa oleks nii hea, saata mulle maili,
aadress peaks siin sama olema.
Nov 23 '07 #4
jodleren wrote:
On Nov 23, 10:24 am, Erwin Moller
<Since_humans_read_this_I_am_spammed_too_m...@spam yourself.comwrote:
>jodleren wrote:
>>Hi!
I started a thread app 2 weeks ago and redlied to that, but it seems
to be so low in the list, that it will not be seen.
My problem - I need to transfer the sesstion to another page?
say page1.php goes to page2.php ( <a href="page2.php") ?
So, s start_sesstion, $_SESSION["fgdf"]=fsdgdf should be readable by
the other file... how do I achive that?
WBR
Sonnich
Add to both pages:
session_start();

Do this before you do anything else, like creating output.
so on page1.php:

session_start();
$_SESSION["test"] = "Hi";

and on page2.php
session_start();
echo $_SESSION["test"];
// should say Hi

Regards,
Erwin Moller

PS: Make sure you have error reporting ON.
PS2: Make sure your php.ini doesn't have session_auto_start on.

Thanks, I got it to work. Toby's explanation cleared things up.
Cool. :-)
>
Erwin, ma vist tunnen sind. Kas sa oleks nii hea, saata mulle maili,
aadress peaks siin sama olema.
Erm....
I am from Holland/The Netherlands, not Sweden.
Or is it norwegian? Danish? Finnish?
Sounds all impossible to me. ;-)

Regards,
Erwin Moller
Nov 23 '07 #5
On Nov 23, 1:40 pm, Erwin Moller
<Since_humans_read_this_I_am_spammed_too_m...@spam yourself.comwrote:
jodleren wrote:
On Nov 23, 10:24 am, Erwin Moller
<Since_humans_read_this_I_am_spammed_too_m...@spam yourself.comwrote:
jodleren wrote:
Thanks, I got it to work. Toby's explanation cleared things up.

Cool. :-)
Erwin, ma vist tunnen sind. Kas sa oleks nii hea, saata mulle maili,
aadress peaks siin sama olema.

Erm....
I am from Holland/The Netherlands, not Sweden.
Or is it norwegian? Danish? Finnish?
Sounds all impossible to me. ;-)
Estonian. I once had contact to him around here, he works with that
kind of stuff too... :-)

Grootjes
Sonnich
Nov 23 '07 #6

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

Similar topics

2
by: The Plankmeister | last post by:
Hi... I'm trying my hardest to understand fully how sessions work and how best to use them. However, all I can find is information that doesn't tell me anything other than that sessions store...
13
by: jing_li | last post by:
Hi, you all, I am a newbee for php and I need your help. One of my coworker and I are both developing a webpage for our project using php. We have a copy of the same files in different location...
3
by: Maxime Ducharme | last post by:
Hi group We have a problem with sessions in one of our sites. Sessions are used to store login info & some other infos (no objects are stored in sessions). We are using Windows 2000 Server...
3
by: Will Woodhull | last post by:
Hi, I'm new here-- I've been reading the group for a couple of days. Nice group; I like the way n00b33 questions are handled. I've been using a Javascript routine in index.html to determine a...
2
by: Steve Franks | last post by:
According to the docs you tell ASP.NET to use cookieless sessions by setting a value in the config.web file. However, what if I wanted to determine at run time whether or not I wanted to use...
12
by: D. Shane Fowlkes | last post by:
This is a repost (pasted below). Since my original post, I've double checked the system clock and set all IIS Session Timeout values to 10 minutes. Still ...the problem occurs. I've also...
6
by: Daniel Walzenbach | last post by:
Hi, I have a web application which sometimes throws an “out of memory” exception. To get an idea what happens I traced some values using performance monitor and got the following values (for...
22
by: magic_hat60622 | last post by:
Hi all. I've got an app that dumps a user id into a session after successful login. the login page is http://www.mydomain.com/login.php. If the user visits pages on my site without the www (i.e.,...
13
Frinavale
by: Frinavale | last post by:
One of the most fundamental topics in web design is understanding how to pass information collected on one web page to another web page. There are many different ways you could do this: Cookies,...
3
Atli
by: Atli | last post by:
Introduction: Sessions are one of the simplest and more powerful tools in a web developers arsenal. This tool is invaluable in dynamic web page development and it is one of those things every...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.