Re: [SMARTY] smarty variables in forms?
| From: | zzd | Date: | Mon, 05 May 2003 19:00:29 +0000 |
| Subject: | Re: [SMARTY] smarty variables in forms? | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-9473@lists.php.net to get a copy of this message | ||
On Monday 05 May 2003 02:03 pm, Prince wrote:
> hi
>
> i have a few forms that i need to use in smarty... how would i use
> the variables in smarty? like <input type="text" name="company">
> that is just the plain html file... should i leave the form out of
> the smarty stuff or should i put in the smarty stuff.. and if so how
> should i go about doing it...
This is best explained in the documentation on the smarty site, but here
is a quick rundown.
<?php
$companyName = 'Templates Inc.';
$smarty->assign('inputName', 'Company');
$smarty->assign('inputValue', $companyName);
$smarty->display('pathToForm/template.tpl');
?>
And your template will look something like...
<html><body><form>
<input type="text" name="{$inputName}" value="{$inputValue}">
</form>