This is another dynamic form element from my collection. I use this function in forms where a value of a database will be filled inside the form field. This is an easy way to get the right value inside the field if the form is submitted before and/or the process is stopped because some validation issue occurs. You can use the (optional) database value attribute as a default value, too.
Jose Santos wrote :1283
This type of kinds is very easy and simple!
Why dont use templates ??
The templates has advantage to isolate the code (PHP) of the HTML.
Using templates, the code is more cleary and easy to understand.
See functions to work with templates insided in the PEAR of PHP.
Links:
http://pear.php.net/manual/en/
http://pear.php.net/package/HTML_Template_PHPLIB/docs/1.3/apidoc/HTML_Template_PHPLIB-1.3/Template_PHPLIB.html
Olaf Lederer wrote :1284
You are right it`s possible to do this with other technics. The example is meant for people which don`t want to use smarty (or whatever). I use this kind of function in some quick CMS forms and it works very fast for me.