PHP Sessions
am 13.03.2010 01:29:41 von Martine Osias
Hi:
I need to store variables to send then between pages. I don't need the
variables in a database so I try to send them with sessions. The variables
don't seem to be there when I try to get them. What could be the problem.
Here are the pages where I store and retrieve the variables.
Page 1 (variables stored):
session_start();
$_SESSION['scripture_text'] = $row_scripture['ScriptureText'];
$_SESSION['scripture_ref'] = $row_scripture['ScriptureRef'];
?>
Page 2 (variables retrieved):
session_start();
include("includes/config.php");
?>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
="«".$_SESSION['scripture_text']."»"?> |
|
align="right">=$_SESSION['scripture_ref']?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: PHP Sessions
am 13.03.2010 01:31:09 von Ashley Sheridan
--=-tdoHTPIhwBbxKgXTd8tq
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
On Fri, 2010-03-12 at 19:29 -0500, Martine Osias wrote:
> Hi:
>
> I need to store variables to send then between pages. I don't need the
> variables in a database so I try to send them with sessions. The variables
> don't seem to be there when I try to get them. What could be the problem.
> Here are the pages where I store and retrieve the variables.
>
> Page 1 (variables stored):
>
>
>
> session_start();
>
> $_SESSION['scripture_text'] = $row_scripture['ScriptureText'];
> $_SESSION['scripture_ref'] = $row_scripture['ScriptureRef'];
>
> ?>
>
> Page 2 (variables retrieved):
>
>
> session_start();
> include("includes/config.php");
> ?>
>
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>
>
>
>
>
>
>
>
> ="«".$_SESSION['scripture_text']."»"?> |
>
>
>
> |
> align="right">=$_SESSION['scripture_ref']?>
>
>
>
>
>
>
>
>
>
Are there any errors, either displayed or in the error log?
Thanks,
Ash
http://www.ashleysheridan.co.uk
--=-tdoHTPIhwBbxKgXTd8tq--
Re: PHP Sessions
am 13.03.2010 02:13:02 von Kevin Kinsey
Martine Osias wrote:
> Hi:
>
> I need to store variables to send then between pages. I don't need the
> variables in a database so I try to send them with sessions. The
> variables don't seem to be there when I try to get them. What could be
> the problem. Here are the pages where I store and retrieve the variables.
>
> Page 1 (variables stored):
>
>
>
> session_start();
>
> $_SESSION['scripture_text'] = $row_scripture['ScriptureText'];
> $_SESSION['scripture_ref'] = $row_scripture['ScriptureRef'];
Do sessions work at all? Something simple, like
****************************
//a.php
session_start();
$_SESSION['test']="foo";
echo '';
?>
//b.php
session_start();
echo $_SESSION['test']; // should say "foo"
?>
*************************
... would be a good 1st test.
If that works, I'd suspect that $row_scripture['ScriptureText']
and friends are empty.
If it doesn't, I'd suspect a combination of very strict
browser privacy settings (disallow all cookies) with lame server
config (use_only_cookies), or that session support is missing
or disabled.
HTH,
KDK
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: PHP Sessions
am 13.03.2010 02:15:39 von Kevin Kinsey
Forgot to mention, you could check into the privacy
vs. server settings by doing:
session_start();
echo session_id();
on both pages. If they're different, then
this is the problem.
KDK
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: PHP Sessions
am 13.03.2010 02:29:42 von Andre Polykanine
Hello Martine,
Try to make on the second page a
print_r ($_SESSION);
--
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule
----- Original message -----
From: Martine Osias
To: php-general@lists.php.net
Date: Saturday, March 13, 2010, 2:29:41 AM
Subject: [PHP] PHP Sessions
Hi:
I need to store variables to send then between pages. I don't need the
variables in a database so I try to send them with sessions. The variables
don't seem to be there when I try to get them. What could be the problem.
Here are the pages where I store and retrieve the variables.
Page 1 (variables stored):
session_start();
$_SESSION['scripture_text'] = $row_scripture['ScriptureText'];
$_SESSION['scripture_ref'] = $row_scripture['ScriptureRef'];
?>
Page 2 (variables retrieved):
session_start();
include("includes/config.php");
?>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
="«".$_SESSION['scripture_text']."»"?> |
|
align="right">=$_SESSION['scripture_ref']?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: PHP Sessions
am 13.03.2010 03:33:34 von Martine Osias
The sessions variables are OK. They don't print when I put them on the HTML
page with this code.
="«".$_SESSION['scripture_text']."»"?> |
|
align="right">=$_SESSION['scripture_ref']?>
Thank you.
Martine
""Martine Osias"" wrote in message
news:95.0C.13686.C7CDA9B4@pb1.pair.com...
> Hi:
>
> I need to store variables to send then between pages. I don't need the
> variables in a database so I try to send them with sessions. The variables
> don't seem to be there when I try to get them. What could be the problem.
> Here are the pages where I store and retrieve the variables.
>
> Page 1 (variables stored):
>
>
>
> session_start();
>
> $_SESSION['scripture_text'] = $row_scripture['ScriptureText'];
> $_SESSION['scripture_ref'] = $row_scripture['ScriptureRef'];
>
> ?>
>
> Page 2 (variables retrieved):
>
>
> session_start();
> include("includes/config.php");
> ?>
>
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>
>
>
>
>
>
>
>
> ="«".$_SESSION['scripture_text']."»"?> |
>
>
>
> |
> align="right">=$_SESSION['scripture_ref']?>
>
>
>
>
>
>
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: PHP Sessions
am 13.03.2010 09:46:26 von Ashley Sheridan
--=-nF15QHkDQR9Ws66gOxPu
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
On Fri, 2010-03-12 at 21:33 -0500, Martine Osias wrote:
> The sessions variables are OK. They don't print when I put them on the HTML
> page with this code.
>
>
> ="«".$_SESSION['scripture_text']."»"?> |
>
>
>
> |
> align="right">=$_SESSION['scripture_ref']?>
>
>
> Thank you.
>
>
> Martine
>
> ""Martine Osias"" wrote in message
> news:95.0C.13686.C7CDA9B4@pb1.pair.com...
> > Hi:
> >
> > I need to store variables to send then between pages. I don't need the
> > variables in a database so I try to send them with sessions. The variables
> > don't seem to be there when I try to get them. What could be the problem.
> > Here are the pages where I store and retrieve the variables.
> >
> > Page 1 (variables stored):
> >
> >
> >
> > session_start();
> >
> > $_SESSION['scripture_text'] = $row_scripture['ScriptureText'];
> > $_SESSION['scripture_ref'] = $row_scripture['ScriptureRef'];
> >
> > ?>
> >
> > Page 2 (variables retrieved):
> >
> >
> > session_start();
> > include("includes/config.php");
> > ?>
> >
> > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> >
> >
> >
> >
> >
> >
> >
> >
> > ="«".$_SESSION['scripture_text']."»"?> |
> >
> >
> >
> > |
> > align="right">=$_SESSION['scripture_ref']?>
> >
> >
> >
> >
> >
> >
> >
> >
>
>
Don't use =, it's a crappy short tag and most hosting doesn't support
those sorts of tags.
Instead, use something like this:
Short tags end up causing more problems than they solve sometimes...
Thanks,
Ash
http://www.ashleysheridan.co.uk
--=-nF15QHkDQR9Ws66gOxPu--
Re: Re: PHP Sessions
am 13.03.2010 11:22:13 von Andre Polykanine
Hello Martine,
As you have been already told, the =...?> is not always supported.
However I'd suggest you to do the following (since I love this form of
tag):
«=$_SESSION['scripture_text']?>» |
Note: I put within the tag only the variable.
--
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule
----- Original message -----
From: Martine Osias
To: php-general@lists.php.net
Date: Saturday, March 13, 2010, 4:33:34 AM
Subject: [PHP] Re: PHP Sessions
The sessions variables are OK. They don't print when I put them on the HTML
page with this code.
="«".$_SESSION['scripture_text']."»"?> |
|
align="right">=$_SESSION['scripture_ref']?>
Thank you.
Martine
""Martine Osias"" wrote in message
news:95.0C.13686.C7CDA9B4@pb1.pair.com...
> Hi:
>
> I need to store variables to send then between pages. I don't need the
> variables in a database so I try to send them with sessions. The variables
> don't seem to be there when I try to get them. What could be the problem.
> Here are the pages where I store and retrieve the variables.
>
> Page 1 (variables stored):
>
>
>
> session_start();
>
> $_SESSION['scripture_text'] = $row_scripture['ScriptureText'];
> $_SESSION['scripture_ref'] = $row_scripture['ScriptureRef'];
>
> ?>
>
> Page 2 (variables retrieved):
>
>
> session_start();
> include("includes/config.php");
> ?>
>
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>
>
>
>
>
>
>
>
> ="«".$_SESSION['scripture_text']."»"?> |
>
>
>
> |
> align="right">=$_SESSION['scripture_ref']?>
>
>
>
>
>
>
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: PHP Sessions
am 13.03.2010 11:33:46 von Ashley Sheridan
--=-0FhxSKu77XEYYgSjvQ7w
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
On Sat, 2010-03-13 at 12:22 +0200, Andre Polykanine wrote:
> Hello Martine,
>
> As you have been already told, the =...?> is not always supported.
> However I'd suggest you to do the following (since I love this form of
> tag):
>
«=$_SESSION['scripture_text']?>» |
>
> Note: I put within the tag only the variable.
>
> --
> With best regards from Ukraine,
> Andre
> Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org
> Yahoo! messenger: andre.polykanine; ICQ: 191749952
> Twitter: m_elensule
>
> ----- Original message -----
> From: Martine Osias
> To: php-general@lists.php.net
> Date: Saturday, March 13, 2010, 4:33:34 AM
> Subject: [PHP] Re: PHP Sessions
>
> The sessions variables are OK. They don't print when I put them on the HTML
> page with this code.
>
>
> ="«".$_SESSION['scripture_text']."»"?> |
>
>
>
> |
> align="right">=$_SESSION['scripture_ref']?>
>
>
> Thank you.
>
>
> Martine
>
> ""Martine Osias"" wrote in message
> news:95.0C.13686.C7CDA9B4@pb1.pair.com...
> > Hi:
> >
> > I need to store variables to send then between pages. I don't need the
> > variables in a database so I try to send them with sessions. The variables
> > don't seem to be there when I try to get them. What could be the problem.
> > Here are the pages where I store and retrieve the variables.
> >
> > Page 1 (variables stored):
> >
> >
> >
> > session_start();
> >
> > $_SESSION['scripture_text'] = $row_scripture['ScriptureText'];
> > $_SESSION['scripture_ref'] = $row_scripture['ScriptureRef'];
> >
> > ?>
> >
> > Page 2 (variables retrieved):
> >
> >
> > session_start();
> > include("includes/config.php");
> > ?>
> >
> > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> >
> >
> >
> >
> >
> >
> >
> >
> > ="«".$_SESSION['scripture_text']."»"?> |
> >
> >
> >
> > |
> > align="right">=$_SESSION['scripture_ref']?>
> >
> >
> >
> >
> >
> >
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
That's still using short tags. The time you save on typing is nothing
compared to the time you spend trying to figure out why your script
doesn't work since you moved servers, or copied it to your live server,
or why you are having trouble using XML...
Thanks,
Ash
http://www.ashleysheridan.co.uk
--=-0FhxSKu77XEYYgSjvQ7w--
Re: Re[2]: Re: PHP Sessions
am 13.03.2010 11:49:34 von Ashley Sheridan
--=-coJShrpHO/IOsKOiS40c
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
On Sat, 2010-03-13 at 12:49 +0200, Andre Polykanine wrote:
> Hello Ashley,
>
> And if the site is full of that code?)) I think it's worth to learn
> what's really the reason of the fact that it doesn't work. Besides
> that, it's more readable for me.
> And the right thing that was said here is the following: check the
> php.ini settings and change them if possible.
>
If the site is full of that code I'd make a start on replacing it. A
simple find/replace will work in cases like this.
I try to write my code so that I don't have to make unnecessary changes
to my php.ini. For example, what if I don't have access to my php.ini
and can't set a directive in my .htaccess file? What if I'm sharing my
code with someone? What if I need to work with outputting XML headers?
All of these factors I think outweigh any gains I would get from short
tags.
As for readability, I tend to use a text editor with syntax highlighting
which makes my code readable.
Thanks,
Ash
http://www.ashleysheridan.co.uk
--=-coJShrpHO/IOsKOiS40c--
Re[2]: Re: PHP Sessions
am 13.03.2010 11:49:59 von Andre Polykanine
Hello Ashley,
And if the site is full of that code?)) I think it's worth to learn
what's really the reason of the fact that it doesn't work. Besides
that, it's more readable for me.
And the right thing that was said here is the following: check the
php.ini settings and change them if possible.
--
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule
----- Original message -----
From: Ashley Sheridan
To: Andre Polykanine
Date: Saturday, March 13, 2010, 12:33:46 PM
Subject: [PHP] Re: PHP Sessions
On Sat, 2010-03-13 at 12:22 +0200, Andre Polykanine wrote:
> Hello Martine,
>
> As you have been already told, the =...?> is not always supported.
> However I'd suggest you to do the following (since I love this form of
> tag):
> «=$_SESSION['scripture_text']?>» |
>
> Note: I put within the tag only the variable.
>
> --
> With best regards from Ukraine,
> Andre
> Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ jabber.org
> Yahoo! messenger: andre.polykanine; ICQ: 191749952
> Twitter: m_elensule
>
> ----- Original message -----
> From: Martine Osias
> To: php-general@lists.php.net
> Date: Saturday, March 13, 2010, 4:33:34 AM
> Subject: [PHP] Re: PHP Sessions
>
> The sessions variables are OK. They don't print when I put them on the HTML
> page with this code.
>
>
> ="«".$_SESSION['scripture_text']."»"?> |
>
>
>
> |
> align="right">=$_SESSION['scripture_ref']?>
>
>
> Thank you.
>
>
> Martine
>
> ""Martine Osias"" wrote in message
> news:95.0C.13686.C7CDA9B4@pb1.pair.com...
> > Hi:
> >
> > I need to store variables to send then between pages. I don't need the
> > variables in a database so I try to send them with sessions. The variables
> > don't seem to be there when I try to get them. What could be the problem.
> > Here are the pages where I store and retrieve the variables.
> >
> > Page 1 (variables stored):
> >
> >
> >
> > session_start();
> >
> > $_SESSION['scripture_text'] = $row_scripture['ScriptureText'];
> > $_SESSION['scripture_ref'] = $row_scripture['ScriptureRef'];
> >
> > ?>
> >
> > Page 2 (variables retrieved):
> >
> >
> > session_start();
> > include("includes/config.php");
> > ?>
> >
> > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> >
> >
> >
> >
> >
> >
> >
> >
> > ="«".$_SESSION['scripture_text']."»"?> |
> >
> >
> >
> > |
> > align="right">=$_SESSION['scripture_ref']?>
> >
> >
> >
> >
> >
> >
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
That's still using short tags. The time you save on typing is nothing
compared to the time you spend trying to figure out why your script
doesn't work since you moved servers, or copied it to your live server,
or why you are having trouble using XML...
Thanks,
Ash
http://www.ashleysheridan.co.uk
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php