syntax
| From: | Roger Thomas | Date: | Thu, 04 Jul 2002 14:58:16 +0000 |
| Subject: | syntax | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-5196@lists.php.net to get a copy of this message | ||
i cannot get the value portion of the <input ... > below working.
lets say $z = 3.
if $name is blank, i want to reprint the form, which is no problem BUT
the 3 rows for myvar1, myvar2, myvar3 ALL consists of the values 1,2 and 3 ;
whereas i have keyed in something else.
i have checked that in my php script, after submitting the form, i have done
this:
if ($submit) {
$tpl->assign(array(myvar1 => $myvar1,
myvar2 => $myvar2,
myvar3 => $myvar3,
varname => $yourname));
}
else {
$tpl->display("form.tpl");
}
form.tpl
--------
<form action="<? echo $PHP_SELF ?>">
<tr><td>name: <input type=text name=yourname
value="{$varname}"></td></tr>
{section name=q loop=$z}
<tr>
<TD>
<input type=text name="myvar{$smarty.section.q.iteration}"
value="{$myvar}{$smarty.section.q.iteration}">
</TD>
</tr>
{/section}
<tr><td><input type=submit name=submit value=submit></td></tr>
</form>
please advise.
rgds.
__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com