Session
Posted on
16th Feb 2014 07:03 pm by
admin
I am having a little trouble with a session. Not sure if it is my browser or what. I know I do not have any trouble logging into forums such at these, so not sure why this is not working.
first the code. Just basic code from php documentation plus some added checks.
Code: <?php
// page1.php
if (session_start()) {
echo "OK";
} else {
echo "FAIL";
}
// echo phpinfo();
// echo getcwd();
echo 'Welcome to page #1';
$_SESSION['favcolor'] = 'green';
$_SESSION['animal'] = 'cat';
$_SESSION['time'] = time();
print_r($_SESSION);
// Works if session cookie was accepted
echo '<br /><a href="page2.php">page 2</a>';
// Or maybe pass along the session id, if needed
echo '<br /><a href="page2.php?' . SID . '">page 2</a>';
?>
And
Code: <?php
// page2.php
session_start();
echo 'Welcome to page #2<br />';
echo $_SESSION['favcolor']; // green
echo $_SESSION['animal']; // cat
echo date('Y m d H:i:s', $_SESSION['time']);
print_r($_SESSION);
// You may want to use SID here, like we did in page1.php
echo '<br /><a href="page1.php">page 1</a>';
?>
There is no reason why this should not work. Can someone go to:
http://www.e-sullivan.com/DIITop25/page1.php
and tell me if it works for you? It shows me that the sessions are being started but the variables are not passing between page1.php and page2.php for me.
No comments posted yet
Your Answer:
Login to answer
331
8
Other forums
please help me in this update statment
hi every one
if I have table and this data in it
id name
10
Seperate team from score
I am writing a site that does a NFL Pick 'em type application and I have a feed that gives me the sc
Show message after entering data
Hello Colleagues
I would like to display messages after entering the data example: "
dat
Displaying image pathname instead of image
Hello
Im trying to upload and then display images from a mysql database - Its only basic and
Form Help
Here is the form:
Line number On/Off | Expand/Contract<? include("../include/sess
Find occurences of unicode characters in string
I need to prohibit filenames with everything but English characters and numbers but regexp and strin
tell csv import script to ignore blank rows?
Hi i have the below script but i get an error if a row is blank ie a return in the csv file at the e
How to schedule the a job?
Hi,
I have prepared a task ( i.e. a procedure is prepare the file and send the same to con
Multiple WHILE loops help
Hi there. I'm writing an application that is pulling and displaying results for real estate listing
Code clarification
Hi
In the following code what could be the "search_print()" and where it could be