Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Dedicated server web hosting provided by Guru-host.eu.
Issues with HTML Element Names and Values.

 
Post new topic   Reply to topic    Smarty Forum Index -> Feature Requests
View previous topic :: View next topic  
Author Message
bimal
Smarty Elite


Joined: 19 Apr 2007
Posts: 419
Location: Kathmandu, Nepal

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 )
_________________
Skype: pbimal
To hire instantly as a freelancer - https://www.odesk.com/o/profiles/users/_~~657b70cc7f2c616a/
Visit my website - http://bimal.org.np/ for more articles
800+ screenshots to learn about website mistakes: http://mistakes.sanjaal.com/
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 4177
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: 419
Location: Kathmandu, Nepal

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.
_________________
Skype: pbimal
To hire instantly as a freelancer - https://www.odesk.com/o/profiles/users/_~~657b70cc7f2c616a/
Visit my website - http://bimal.org.np/ for more articles
800+ screenshots to learn about website mistakes: http://mistakes.sanjaal.com/
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    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