Re: [Phplib-users] show_element doesn't present value?
Brought to you by:
nhruby,
richardarcher
From: Lazaro F. <la...@mo...> - 2001-12-12 09:15:56
|
According to Lib.. documentation "show_element($name,$value) Outputs the form element named $name. Usually, the second argument is not used. It is always necessary for radio elements and checkbox elements with the multiple attribute set, since many of these may have the same name. It also must be used for submit elements to label the submission button; the value attribute is not used for submit elements. For other elements that may be array valued (notably text elements) multiple calls to show_element will show successive values." If you want to show a value by default you better include it as part of your add_element() call I would recommend you to use tpl_form class to deal with Databases tpl_form, is a bit hard to understand at the beginning (at least for me) but once you have managed to understand it, it provides you a good pattern design for "databases bounded" forms, you may also (I do), use the query_sql class, to read and write to MYSQL DB, within tpl_form methods : process_input(), and process_default(), tpl_form and query_sql classes working together may do the trick of "BOUNDED FORMS", in a MS VB style, but with some limitations, everything is documented, (see PHPLIB DOC ) On the other hand if you want a very straigth forward example of how to to use DB with FORMS in PHP (without PHPLIB) go to www.webmonkey.com look for a PHP tutorial that covers PHP and MYSQL for the begginers, It was my first PHP reading, ( provided that you have some programming experience ) you will learn everything you need to implement DB "Bounded" Forms in a few hours Hope this help Lazaro ----- Original Message ----- From: Frank Bax <fb...@sy...> To: <php...@li...> Sent: Wednesday, December 12, 2001 5:44 AM Subject: [Phplib-users] show_element doesn't present value? > I'm trying to use phplib-7.2d ooh forms for the first time... > > $f = new form; > $f->add_element(array( > 'type' => 'text', > 'name' => 'realname', > 'size' => 12, > 'maxlength' => 16, > ) ); > $f->show_element('realname','xxxx'); > > This code generates: > <input name='realname' value="" type='text' maxlength='16' size='12'> > > Why don't I get value="xxxx"? > > I want to create a page to maintain a database table. I expect that I > create my form object once with an element for each field; then loop > through my data, producing a form for each row? Is this approach wrong? > > Frank > > _______________________________________________ > Phplib-users mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phplib-users > > > |