Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Cookies assigned variable and stored into PHP variable

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
toplisek
Smarty Regular


Joined: 17 Sep 2009
Posts: 48

PostPosted: Tue Nov 21, 2017 2:49 pm    Post subject: Cookies assigned variable and stored into PHP variable Reply with quote

I like to store cookies value from Smarty official variable into PHP varaible:

If I have form it will be assigned variable like: $smarty->assign("myemail", $_REQUEST['myemail']);

Cookies are detected using official function:
$smarty.cookies.Mycookiename
and like to store into PHP $myvariable

Just example:
$smarty->assign("myvariable",$smarty.cookies.Mycookiename);

How to manage this as it is wrong.
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Tue Nov 21, 2017 3:53 pm    Post subject: Reply with quote

Do NOT use _REQUEST, if you do care about the source of your request parameters.
Use specific autoglobal. I.e. _COOKIE
Back to top
View user's profile Send private message
toplisek
Smarty Regular


Joined: 17 Sep 2009
Posts: 48

PostPosted: Wed Nov 22, 2017 12:32 pm    Post subject: Reply with quote

Can you post example in this case as form has input fields. I'm new to this.
Usually it is solved using field names:
$smarty->assign("emailfield1", $_REQUEST['emailfield1']);

email value is captured using $_REQUEST['emailfield1'] and stored and assigned to Smarty variable called $emailfield1

and HTML as usual:
<input name="emailfield1" maxlength="45">

What will be code in your example?
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Wed Nov 22, 2017 5:23 pm    Post subject: Reply with quote

Read my previous reply, until you understand it.
I already answered the question you just asked.
Back to top
View user's profile Send private message
toplisek
Smarty Regular


Joined: 17 Sep 2009
Posts: 48

PostPosted: Thu Nov 23, 2017 10:15 am    Post subject: Reply with quote

Thank you for all replies.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP