Welcome to WebmasterWorld Guest from 34.231.21.123

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

How to set execution of form when variable is set in Smarty?

     
3:06 pm on May 13, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Oct 25, 2006
posts: 1108
votes: 1



I have used Smarty based framework.


I have defined variable inside controller file
$var['contact_form'] = true;
$var['contact_form_code'] = " ";

Form:
form id="contact_form" action="URL" method="post">
<p>

<input type="submit" name="contact_form1" value="Send" class="sendclass" />

How to
1. execute store posted values inside variables and
2. form can be submitted after validation is done?
6:32 pm on May 16, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Oct 25, 2006
posts: 1108
votes: 1


Is possible to help?
2:11 am on May 17, 2011 (gmt 0)

Full Member

10+ Year Member

joined:June 1, 2007
posts:201
votes: 0


If you mean you have assigned a smarty variable in the php file so
$smarty->assign("contactForm",true);

then in your tpl file something like
{if $contactForm}
form content
{else}
no form content
{/if}
as far as submitting the form after the validation is done would be backwards you can use some javascript to validate some field values on the fly but you still will need to check your input in the php script with some real checking after the form is submitted.
7:26 am on May 17, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

joined:Oct 25, 2006
posts: 1108
votes: 1


This assign is to set form display.

I like to know how to set values from inputs into message (mail script).

I have the following:
<p>
<label class="input1">Familiy name</label>
<input id="text1" name="{$varname}" size="60" maxlength="60" class="required" />
</p>

and assigned:
$smarty->assign('varname', $_POST['varname']);