php - WPMVC : dropdown list -
i using wpmvc plugin wordpress, struggling formhelpers. want make dropdownlist example gender male/female. why doesnt select method show text. , if shows text in dropdown doesnt save in database name field.
view/add.php
<h2>add artist</h2> <?php echo $this->form->create($model->name); ?> <?php echo $this->form->input('name'); ?> <?php echo $this->form->select('gender', $options = array('male' => 'male' ,'female' => 'female')); ?> <?php echo $this->form->end('add'); ?>
admin/artistcontroller.php
class adminartistscontroller extends mvcadmincontroller { var $default_columns = array('id', 'name', 'gender'); public function add() { $this->set_artists(); $this->create_or_save(); } public function edit() { $this->set_artists(); $this->verify_id_param(); $this->set_object(); $this->create_or_save(); } private function set_artists() { $this->load_model('artist'); $artists = $this->artist->find(array('selects' => array('id', 'name'))); $this->set('artists', $artists); }
Comments
Post a Comment