nesting template variables
| From: | Jan | Date: | Thu, 08 Apr 2004 16:02:08 +0000 |
| Subject: | nesting template variables | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-11251@lists.php.net to get a copy of this message | ||
Hi,
I have an basic form_1 with
<input name="insert_row_{$name}" type="text">
where $name is the field_name from an mysql table (insert_row_ is to keep
variables "similar" for a couple of input fields, can be exchanged)
So far there is no problem. After submitting the form to another page, i
want to show the same input fields from same table, but this time with
<input name="insert_row_{$name}" type="text" value="{if
isset($insert_row_$name)}{$insert_row_{$name}}{/if}"> (form_2)
This shows same name (of input) as above (must be because it's the same
variable). All variables entered in form_1 are assigned to template of
form_2 and now the problem left:
I want dynamically (to use this with various tables) have the values entered
in form_1 appear in form_2 using
{$insert_row_{$name}}
whis is meant this way: "insert_row_{$name}" is input name (no problem for
smarty compiler), and "{$insert_row_{$name}}" is the assigned value.
Is there a way to first set (or force) $name (e.g. $name=Field1) (result:
{$insert_row_Field1}) and then set the resulting var to it's value (e.g.
$insert_row_Field1 = Value1) (result: Value1)
Thanks in advance
Jan