if you want to write a session variable, you can use the session helper
in your controller, add 'Session' in $helpers array
in your view, call $session->read('mailcode')
scott lewis a écrit :
On 16-Jan-2007, at 10:10, Flexewebs wrote:
>
> Hi guys,
>
> How do I print a session variable in a view please?
>
> I am using the following code in the controller to write a session
> variable.
>
> $this->Session->write('mailcode', $_POST["mailcode"]);
>
> I am wanting to specifically use the session variable within my
> view if
> at all possible.
Set it as a view variable as well. The Session is for passing data
between requests, View vars are for passing data to the View.
$this->set('mailcode', $_POST["mailcode"]);
Also, pulling things straight out of $_POST is always a bad idea. For
one thing Cake has already pulled it out for you (into $this->params)
and, for another, you are tossing raw input around without validating
or sanitizing it...
s.
--Apple-Mail-4--465685401
Content-Type: application/pgp-signature
Content-Disposition: inline;
filename="PGP.sig"
content-description: This is a digitally signed message part
X-Google-AttachSize: 187
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---