Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 11th, 2003, 07:47 AM
Registered User
 
Join Date: Sep 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default session variables not registering

hi

for some reason when i first set the value of session variable it does not get recognised straight away. After two ir three attempts the session variable will be found.

i'm using the session to check that a user is valid to the system. I have session start at the top of both pages.

does anyone have any ideas.

thanks
 
Old September 11th, 2003, 01:05 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

How are you checking the session? Are you just opening the first session page and refreshing it? How is the session ID being passed back to PHP?

Can you be a bit more specific about your script and setup?

The easiest configuration you can do is to turn on session.use_cookies and session.enable_trans_sid (my spellings might be off).

use_cookies means that PHP will store and retrieve the user's session ID in a cookie for you, so you don't have to pass it around as a hidden form field or append it to all your intrasite links.

enable_trans_sid means that PHP will automagically add any required hidden form fields and append the session ID to any intrasite links FOR you.


That said, the most simple session-enabled page is:

<?php
session_start();

$_SESSION['count'] = isset($_SESSION['count'])? $_SESSION['count'] + 1 : 1;

echo "You've seen this page {$_SESSION['count']} times.\n";
?>


Take care,

Nik
http://www.bigaction.org/





Similar Threads
Thread Thread Starter Forum Replies Last Post
Session Variables in C# shikha09 C# 1 November 28th, 2006 10:38 AM
Session Variables testsubject Visual Studio 2005 8 March 8th, 2006 04:26 PM
Session Variables - help? Annoyamouse BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 11 August 31st, 2004 03:56 PM
Session Variables flesh_god Dreamweaver (all versions) 7 November 11th, 2003 05:52 PM
session variables help face Classic ASP Databases 4 September 12th, 2003 03:57 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.