|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
toplisek Smarty Regular
Joined: 17 Sep 2009 Posts: 48
|
Posted: Tue Nov 21, 2017 2:49 pm Post subject: Cookies assigned variable and stored into PHP variable |
|
|
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 |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Tue Nov 21, 2017 3:53 pm Post subject: |
|
|
Do NOT use _REQUEST, if you do care about the source of your request parameters.
Use specific autoglobal. I.e. _COOKIE |
|
Back to top |
|
toplisek Smarty Regular
Joined: 17 Sep 2009 Posts: 48
|
Posted: Wed Nov 22, 2017 12:32 pm Post subject: |
|
|
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 |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Wed Nov 22, 2017 5:23 pm Post subject: |
|
|
Read my previous reply, until you understand it.
I already answered the question you just asked. |
|
Back to top |
|
toplisek Smarty Regular
Joined: 17 Sep 2009 Posts: 48
|
Posted: Thu Nov 23, 2017 10:15 am Post subject: |
|
|
Thank you for all replies. |
|
Back to top |
|
|
|
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
|