Re: howto handle formdata with smarty?!
[email protected] (Pedro) Sun, 03 Dec 2006 16:48:38 +0000
| Newsgroups | php.smarty.general |
|---|---|
| Message-ID | <[email protected]> |
The $vars in the template are numbered 11,12,13 and not 1,2,3 ;-)
> $smarty->assign('var1',$index1);
> $smarty->assign('var2',$index2);
> $smarty->assign('var3',$index3);
> {$var11}
> {$var12}
> {$var13}
pete
Tamer Higazi wrote:
> Hi people!
> I have problems handling formdata with smarty. The template with
> "formular.tpl" is a small html template with a form itself and
> "formular.php" is the script!
>
> Can somebody help me?!
>
> Tamer
>
> formular.tpl:
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "http://www.w3.org/TR/html4/loose.dtd">
> <html>
> <head>
> <title>Tabelle mit Werten...</title>
> <meta name="generator" content="Bluefish 1.0.7">
> <meta name="author" content="Tamer Higazi">
> <meta name="date" content="2006-12-03T10:21:43+0200">
> <meta name="copyright" content="">
> <meta name="keywords" content="">
> <meta name="description" content="">
> <meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
> <meta http-equiv="content-type" content="text/html; charset=UTF-8">
> </head>
> <body>
> <pre>
> <form method="POST" enctype="text/plain" target="_self"
> action="formular.php">
> <input type="text" name="number1" size="20" maxlength="20">
> <input type="text" name="number2" size="20" maxlength="20">
> <input type="text" name="number3" size="20" maxlength="20">
> <input type="submit" name="los" value="Hau drauf!">
>
> </form>
> {$var11}
> {$var12}
> {$var13}
> </pre>
> </body>
> </html>
>
> formular.php:
>
> <?php
> require_once('Smarty/Smarty.class.php');
>
> $smarty = new Smarty();
> $smarty->template_dir = '/home/tamer/public_html/smarty/templates';
> $smarty->compile_dir = '/home/tamer/public_html/smarty/templates_c';
> $smarty->cache_dir = '/home/tamer/public_html/smarty/cache';
> $smarty->config_dir = '/home/tamer/public_html/smarty/configs';
> $smarty->caching = false;
> $smarty->force_compile = true;
>
> $index1 = $_REQUEST["number1"];
> $index2 = $_REQUEST["number2"];
> $index3 = $_REQUEST["number3"];
>
> $smarty->assign('var1',$index1);
> $smarty->assign('var2',$index2);
> $smarty->assign('var3',$index3);
> $smarty->display('formular.tpl');
> ?>