Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8419949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:45:27+00:00 2026-06-10T02:45:27+00:00

I have the following Zend_Debug value for Albums and Category in my IndexController: array(4)

  • 0

I have the following Zend_Debug value for Albums and Category in my IndexController:

    array(4) {
  ["id"] => string(1) "1"
  ["artist"] => string(18) "Paula Abdul Rashid"
  ["title"] => string(13) "Sunny Side Up"
  ["category_id"] => NULL
}

array(10) {
  [0] => array(2) {
    ["id"] => string(1) "1"
    ["name"] => string(7) "Country"
  }
  [1] => array(2) {
    ["id"] => string(1) "2"
    ["name"] => string(7) "Hip Hop"
  }
  [2] => array(2) {
    ["id"] => string(1) "3"
    ["name"] => string(4) "Jazz"
  }
  [3] => array(2) {
    ["id"] => string(1) "4"
    ["name"] => string(14) "Latin American"
  }
  [4] => array(2) {
    ["id"] => string(1) "5"
    ["name"] => string(3) "Pop"
  }
  [5] => array(2) {
    ["id"] => string(1) "6"
    ["name"] => string(3) "R&B"
  }
  [6] => array(2) {
    ["id"] => string(1) "7"
    ["name"] => string(4) "Rock"
  }
  [7] => array(2) {
    ["id"] => string(1) "8"
    ["name"] => string(3) "Ska"
  }
  [8] => array(2) {
    ["id"] => string(1) "9"
    ["name"] => string(5) "Asian"
  }
  [9] => array(2) {
    ["id"] => string(2) "10"
    ["name"] => string(11) "Modern folk"
  }
}

And in my Form_Albums I have the following form elements :

$id = new Zend_Form_Element_Hidden('id');
        $id->addFilter('Int');

        $artist = new Zend_Form_Element_Text('artist');
        $artist->setLabel('Artist')
               ->setRequired(true)
               ->addFilter('StripTags')
               ->addFilter('StringTrim')
               ->addValidator('NotEmpty');

        $title = new Zend_Form_Element_Text('title');
        $title->setLabel('Title')
              ->setRequired(true)
              ->addFilter('StripTags')
              ->addFilter('StringTrim')
              ->addValidator('NotEmpty');

        $category = new Zend_Form_Element_Select('category');
        $category->setLabel('Category')
                ->setRequired(true);


        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setAttrib('id', 'submitbutton');



        $this->addElements(array($id, $artist, $title, $category, $submit));

I couldn’t get the dropdownlist display using the Zend_Form_Element_Select..

Update for Solutions:

I got it working now by using the following:

$category = new Application_Model_DbTable_Category();
$category_list = $category->findForSelect();


foreach ($category_list as $cat) {     //$data is your array variable
    Zend_Debug::dump($cat['id']." :: ". $cat['name']);
    $form->category->addMultiOption($cat['id'], $cat['name']);      
}

Thanks to Rishi for opening the idea.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T02:45:29+00:00Added an answer on June 10, 2026 at 2:45 am

    Something like this in your controller might help you out..

    $form = new Form_Albums();
    foreach ($data as $c) {     //$data is your array variable
    $form->category->addMultiOption($c->id, $c->name);      
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Zend Framework: I have the following url /base/url/[number]/[string] OR /base/url/action/controller/param/value I want in the
I have used following code in IndexController: $view = new Zend_View(array('scriptPath' =>'C:\Users\398853\Documents\NetBeansProjects\PhpProject3\application\views\scripts')); echo $view->render('index.phtml');
I have following query in my project, $values = array(test=>value) $this->_db->update(tablename,$values,array('id = ?'=> $data['id'],'wid
I have the following code in zend: $arrErrors=array(); if (!empty($this->post['submit'])) { // Each time
I have the following code in IndexController.php: $sql = 'SELECT * FROM ?'; $stmt
I have added following code to my login form $csrf = $this->createElement('hash', 'csrf', array('salt'
I have the following code to create the Zend Lucene index $doc->addField(Zend_Search_Lucene_Field::UnStored('keywords', $job->getKeywords())); $doc->addField(Zend_Search_Lucene_Field::UnStored('title',
I have the following code: $routes = array( 'twitter_output' => new Zend_Controller_Router_Route( 'twitter/:username\.:format', array('controller'
I have the following route defined: $route = new Zend_Controller_Router_Route( 'users/:id', array( 'controller' =>
In my Zend Framework app, I have following code: index.php $app_started_time = time(); layout.phtml

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.