You are here: Re: Quickform - edit form « PHP « IT news, forums, messages
Re: Quickform - edit form

Posted by Leonie on 10/01/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

 

Navigation:

[Reply to this 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

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