Re: Re: PHP Sessions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
> 
> <tr>
>  <td align="left"><?="&laquo;".$_SESSION['scripture_text']."&raquo;"?></td>
>  </tr>
> 
> <tr>
>  <td style="font-size: smaller;" 
> align="right"><?=$_SESSION['scripture_ref']?></td>
>  </tr>
> 
> Thank you.
> 
> 
> Martine
> 
> ""Martine Osias"" <webinq1@xxxxxxxxx> wrote in message 
> news:95.0C.13686.C7CDA9B4@xxxxxxxxxxxxxxx
> > 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):
> >
> > <?php
> >
> > session_start();
> >
> > $_SESSION['scripture_text']  = $row_scripture['ScriptureText'];
> > $_SESSION['scripture_ref']  = $row_scripture['ScriptureRef'];
> >
> > ?>
> >
> > Page 2 (variables retrieved):
> >
> > <?php
> > session_start();
> > include("includes/config.php");
> > ?>
> > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
> > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> > <html xmlns="http://www.w3.org/1999/xhtml";>
> > <head>
> > </head>
> > <body>
> >
> > <table width="100%" align="center" border="0">
> >
> > <tr>
> > <td align="left"><?="&laquo;".$_SESSION['scripture_text']."&raquo;"?></td>
> > </tr>
> >
> > <tr>
> > <td style="font-size: smaller;" 
> > align="right"><?=$_SESSION['scripture_ref']?></td>
> > </tr>
> >
> > </table>
> >
> > </body>
> > </html>
> >
> > 
> 
> 


Don't use <?=, it's a crappy short tag and most hosting doesn't support
those sorts of tags.

Instead, use something like this:

<?php echo $_SESSION['scripture_text']; ?>

Short tags end up causing more problems than they solve sometimes...

Thanks,
Ash
http://www.ashleysheridan.co.uk



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux