我有以下形式:Zend框架:填充DB數據Zend的形式下拉元素
<?php
class Application_Form_RegistrationForm extends Zend_Form{
public function init(){
$country = $this->createElement('select', 'country');
$country->setLabel('country: ')
->setRequired(true);
$email = $this->createElement('text', 'email_address');
$email->setLabel('Email Address: ')
->setRequired(true);
$register = $this->createElement('submit', 'register');
$register->setLabel('Create new Account')
->setIgnore(true);
$this->addElements(array(
$country, $email, $register
));
}
}
?>
的國家名單是存在於一個數據庫中的表country
。
無論如何,我可以使用數據庫中的國家名填充國家下拉列表嗎?
任何幫助表示讚賞。
感謝
非常感謝您的支持幫助 – Phantom007 2010-10-18 07:49:58
,然後當這不起作用,因爲沒有解釋新的Application_Model_Country()... – 2013-01-28 01:14:22