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

Issues with HTML Element Names and Values.

 
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 -> Feature Requests
View previous topic :: View next topic  
Author Message
bimal
Smarty Elite


Joined: 19 Apr 2007
Posts: 423

PostPosted: Thu Jul 15, 2010 6:32 pm    Post subject: Issues with HTML Element Names and Values. Reply with quote

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 Wink )
Back to top
View user's profile Send private message Visit poster's website
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Thu Jul 15, 2010 6:53 pm    Post subject: Reply with quote

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
View user's profile Send private message
bimal
Smarty Elite


Joined: 19 Apr 2007
Posts: 423

PostPosted: Thu Jul 15, 2010 8:13 pm    Post subject: I have upgraded it Reply with quote

I have the upgraded version of Smarty, and later one works Smile

However, I am converting to underscores as well for better management, and no such conflicts.

Thanks U. T.
Back to top
View user's profile Send private message Visit poster's website
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 -> Feature Requests 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