logo       
Google Custom Search
    AddThis Social Bookmark Button

getAll() and HTML_QuickForm help needed please: msg#00387

Subject: getAll() and HTML_QuickForm help needed please
Hi everyone,

I am real close to getting my first section of code done and I am stuck.

I am trying to move a form of mine over to HTML_QuickForm and am not sure how to get the values of an array created with getAll() into my HTML_QuickForm select element.

Here is what I have:

// query
$sql = "SELECT *
       FROM tbl_dra
       WHERE 1
       ORDER BY area ASC";

$qa = $db->getAll($sql, DB_FETCHMODE_ASSOC);
if (DB::iserror($qa)){
        die($qa->getMessage());
}

I currently display this in my form (NOT HTML_QuickForm) as such:
// from my form
foreach( $qa as $thearea ) {
echo "<option value=\"" . $thearea['id' ] . "\">". $thearea ['area' ] . "</option>\n" ;
}

Looking at the examples in the docs, I see that I need to populate the select like this:

$form->addElement('select', 'iselTest', 'Test Select:', array('A'=>'A', 'B'=>'B','C'=>'C','D'=>'D'));

But I don't know how to get the array from getAll() into a variable or something I can use in HTML_QuickForm.

Thanks for any help,
Charles


--
PEAR General Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>