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 8773275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:15:13+00:00 2026-06-13T18:15:13+00:00

I am trying to populate a select list ( Zend_Form_Element_Select ) and i have

  • 0

I am trying to populate a select list (Zend_Form_Element_Select) and i have these two arrays i tried. (These are var dumps)

This one works:

array(2) {
  [0] => array(2) {
    ["key"] => int(1)
    ["value"] => string(4) "Test"
  }
  [1] => array(2) {
    ["key"] => int(2)
    ["value"] => string(5) "Test2"
}

This one doesn’t:

array(3) {
  [0] => array(2) {
    ["key"] => int(1)
    ["value"] => string(16) "Test Kategorie 1"
  }
  [1] => array(2) {
    ["key"] => int(2)
    ["value"] => string(16) "Test Kategorie 2"
  }
  [2] => array(2) {
    ["key"] => int(3)
    ["value"] => string(4) "rene"
  }
}

This is a snippet of my code:

$select = new Zend_Form_Element_Select('video_category', array(
      'required'      => true,
      'label'         => 'label_video_category',
    //'multioptions'    => $this->categories,
      'description'   => 'text_video_category',
      'class'         => 'input',
      'id'          => 'select_video_category'
));
$options =  array(
            array(  'key'   => 1, 
                    'value' => 'Test'),
            array(  'key'   => 2,
                    'value' => 'Test2'),
         );
Zend_Debug::dump($options);
$select->addMultioptions($this->categories);
$this->addElement($select);

So if anybody has any clue for me, i’d be very thankful, because i’m stuck with this for hours now…

  • 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-13T18:15:14+00:00Added an answer on June 13, 2026 at 6:15 pm

    You are using $this->categories in addMultioptions. Just verify if you are assigning the options to this variable.

         $this->categories = $options;
    

    The following code worked for me for both the arrays:

          $form = new Zend_Form();
          $select = new Zend_Form_Element_Select('video_category', array(
                     'required'      => true,
                     'label'         => 'label_video_category',
                      'description'   => 'text_video_category',
                      'class'         => 'input',
                     'id'          => 'select_video_category'
        ));
    
        $select->addMultioptions($this->categories);
    $form->addElement($select);
    

    Arrays used:

       $options =  array(
            array(  'key'   => 1, 
                    'value' => 'Test'),
            array(  'key'   => 2,
                    'value' => 'Test2'),
         );
    
       $options = array(
        array(  'key'   => 1, 
                    'value' => 'Test Kategorie 1'),
        array(  'key'   => 2,
                    'value' => 'Test Kategorie 2'),
        array(  'key'   => 3,
                    'value' => 'rene')
        );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to populate a select list with AJAX as follows: HTML: <table>
I am trying to populate a select list with time. I want to create
I am trying to populate a <select> element via Ajax. It works great in
So I have trouble trying to use any of these two elements for different
What I am trying to do is populate one listview, from two different tables
I am trying to populate Select using knockout data-bind option for a list of
Using PHP, I'm trying to populate an HTML list with data from two different
I am trying to populate an HTML select list using an array of customer
I have a non-mvc application that needs to dynamically populate a select list, so
I've been trying to solve my question based off of this answer: Populate select

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.