Default variable values for forms
| From: | Lech Rychli�ski | Date: | Sat, 22 Jun 2002 13:25:34 +0000 |
| Subject: | Default variable values for forms | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-4968@lists.php.net to get a copy of this message | ||
Gdańsk 22 czerwca 2002, 15:17
Hi.
I've a line from my form like this:
<input type="text" name="name" value={$post.name}>
and in my php file sth like this:
if ($method == 'POST')
$tpl -> assign('post', $_POST);
everything is ok when I'm parsing submited form, problems appears when
the method is GET. then in my input field i've got 'Undefined index:
name'
manual says that i can do sth like this:
<input type="text" name="name"
value={$post.name|default:" "}>
but in fact it doesn't change anything because I see error about name
index again. i've tried even sth like this:
{assign var="name" value=$post.name|default:"nothing"}
<input type="text" name="name" value={$name}>
no effect.
so my question is how to put posted values into form if i need to
reedit sth and do not generate errors when sth is missing.
greets
______________________________________________________________________
Lech Rychliński <> l.rychlinski@w3crew.com.pl <> lejzik.w3crew.com.pl