|
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 |
bimal Smarty Elite
Joined: 19 Apr 2007 Posts: 423
|
Posted: Thu Jul 15, 2010 6:32 pm Post subject: Issues with HTML Element Names and Values. |
|
|
I can write HTML Element as:
<input type="text" name="subdomain-name" value="{$smarty.post.subdomain-name}">
I can use $_POST['subdomain-name'] successfully.
You might have guessed the problem now.
I want to keep the same name for the value assigned by Smarty.
{$smarty.post.subdomain-name} is wrong. It tries to subtract, and gives the output: 0.
Can we fix it somehow? (not by using different name to assign ) |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Thu Jul 15, 2010 6:53 pm Post subject: |
|
|
You should avoid '-' in POST or GET parameter names. Use
$_POST['subdomain_name'].
Otherwise you have to use workarounds
Smarty2:
{assign var=foo value='subdomain-name'}
{$smarty.post.$foo}
Smarty3
{$smarty.post.{'subdomain-name'}} |
|
Back to top |
|
bimal Smarty Elite
Joined: 19 Apr 2007 Posts: 423
|
Posted: Thu Jul 15, 2010 8:13 pm Post subject: I have upgraded it |
|
|
I have the upgraded version of Smarty, and later one works
However, I am converting to underscores as well for better management, and no such conflicts.
Thanks U. T. |
|
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
|