Reply to Re: Quickform - edit form

Your name:

Reply:


Posted by Leonie on 10/04/23 11:10

Just as a follow up.

Marek sent me a reply, but for some mysterious reason it didn't appear
on the list:

>Use either HTML_QuickForm::setDefaults() to set defaults for all
>elements or HTML_QuickForm_element::setValue() to set value for
>individual elements. Former is simpler, and if you name the forms
>elements after the table columns, you can directly pass in array
>fetched from sql query.

I've been able to fill out all the form data as follows, using PEAR DB:

//get the form data if it is an edit form
if ($_GET['id']) {
$sql = 'SELECT * FROM '.TBL_BOOK.' WHERE ID='.$_GET['id'];
$res = $db->query($sql);
$data = $res->fetchRow(DB_FETCHMODE_ASSOC);
$form->setDefaults($data);
}

As long as the fields are named the same as the table columns, this
works well.

Thank you to everyone who helped me with this.

Leonie

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация