473,503 Members | 2,167 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

$_SESSION does not work to me...

Hi,

Another newbie question.

I'm using to do a test

$_SESSION["count"]++;

after a POST action, but evry time the page is reloaded $_SESSION is never
initialized... why?

Thanks
Aug 26 '07 #1
3 2602
On Aug 26, 5:25 pm, "Fabio" <znt.fa...@virgilio.itwrote:
Hi,

Another newbie question.

I'm using to do a test

$_SESSION["count"]++;

after a POST action, but evry time the page is reloaded $_SESSION is never
initialized... why?

Thanks
Do you have session_start() at the beginning of your page?

Aug 26 '07 #2
"ZeldorBlat" <ze********@gmail.comha scritto nel messaggio
news:11**********************@k79g2000hse.googlegr oups.com...
>
Do you have session_start() at the beginning of your page?
mmm... you're right, thanks.
But I read somewhere that with $_SESSION it was useless to call
session_start() and others session functions... :(

session_start() never reset the $_SESSION, right?
I have to call it at evry page POST or I have to check if session was
already started and only if not I will call session_start()?

Thanks again ;)
Aug 26 '07 #3
On Aug 26, 6:42 pm, "Fabio" <znt.fa...@virgilio.itwrote:
"ZeldorBlat" <zeldorb...@gmail.comha scritto nel messaggionews:11**********************@k79g2000hse .googlegroups.com...
Do you have session_start() at the beginning of your page?

mmm... you're right, thanks.
But I read somewhere that with $_SESSION it was useless to call
session_start() and others session functions... :(
You're thinking of session_register()
>
session_start() never reset the $_SESSION, right?
I have to call it at evry page POST or I have to check if session was
already started and only if not I will call session_start()?
Just call session_start() the top of every page. Otherwise the
session variables will not be available. If you do it once at the top
of the page you don't need to check if it's started every time you
want to access a session variable. Of course you could also enable
session.auto_start in php.ini -- but I wouldn't recommend that for a
variety of reasons.

Aug 26 '07 #4

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

Similar topics

0
2571
by: Thomas Carcaud | last post by:
I read php manual many times but I can't figure out register_globals works. I m using Php 4.3.2 and register_globals on. It seems to have different effects on $_GET and $_SESSION. First with $_GET...
2
16250
by: Håvard Olerud Eriksen | last post by:
I've been working on a webshop, and I've got most of the functionality up and running. One problem, however, that I don't seem to be able to solve is as follows. My shopping cart is stored in...
5
2962
by: Ken | last post by:
What am I doing wrong? I set the variable co_name on the first page with an <input.... > and session_start() at the top of both pages. Clicking on a link that takes me to the second page: ...
2
1627
by: Svend Andreas Horgen | last post by:
I used to believe I fully understood sessions... Apparently PHP does not handles numeric indexes in $_SESSION, as far as I can see. The same yields for both PHP 4 and 5. Suggestions or explanations...
3
14888
by: Phil Powell | last post by:
PHP: unset($_SESSION); In my original environment (PHP 4.3.2) this line will delete the session variable 'mainDisplay'. But in the testing environment (PHP 4.3.6) the variable persists even...
4
1928
by: comp.lang.php | last post by:
This is an urgent request (as always) generate_admin_customer_position_dropdown($customerResult, $customerResult->id); print_r($_SESSION); This code will generate an HTML dropdown as...
21
3028
by: axlq | last post by:
Someone please tell me if I've discovered a PHP bug. I'm sitting in front of several computers on my home network, behind a NAT firewall/router. I am testing my web site on these different...
12
41119
by: Michael Windsor | last post by:
I've been trying to integrate some PHP pages of my own with some existing code. The details of this are for the support forums for that code (where I have been asking questions), but I wonder if...
15
5921
by: Evil Otto | last post by:
My page loads, and calls an init() function that returns content to a div on the page, as well as setting a $_SESSION variable. The content it returns includes a link that calls the same variable,...
4
2042
by: Pseudonyme | last post by:
Dear Sirs and Madams, Receive as information that storing a MYSQL result under $_SESSION was accelerating web page displays processes ? Absolutly needed but impossible to get this working ! I...
0
7205
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,...
1
7011
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
7468
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
5596
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 project—planning, coding, testing,...
1
5023
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...
0
4689
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3170
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
747
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.