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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:30:55+00:00 2026-06-12T09:30:55+00:00

I have a dropdown menu grabbing all the flag (or call it tags) values

  • 0

I have a dropdown menu grabbing all the flag (or call it tags) values from a database table using the zend view helper, formSelect() function but the values are displaying in an array format. I only need the flag value names themselves.

Here is the code within my view phtml file to display the drop down menu:

<td><?php echo $this->formSelect('flag_id', null, null, $this->aFlags); ?> </td>

The flag methods are in this class:

class App_Flags extends App {

public $rows = array(iPropertyID);

public function __construct() {
parent::__construct();
}

public function getPropFlags() {
$flag_tcid = 4;

$oSql = new Db_Table_Flags();
$oSelect = $oSql->select();
$oSelect->from(array('f' => 'flags'),array('value' => 'flag_name'));
$oSelect->where('flag_type_category = ?', $flag_tcid);
$rowCount = count($oSelect);

if ($rowCount > 0) {
    echo "found $rowCount rows";
}  else {
    echo 'no rows matched the query';
}

$result = $oSql->fetchAll($oSelect)->toArray();

return $result;

}

The drop down menu displays the values as follow:

   0 
    flag name 
   1  
    another flag name 
   2  
    flag name again  
   3 
    flag name here

I do not want the array keys displayed in the drop down. I only need the flag names.
It seems like the first parameter in the formSelect() is being ignored b/c its pulling an array according to this:

string formSelect (string|array $name, [mixed $value = null], [array|string $attribs = null], [array $options = null], [string $listsep = “
\n”])
string|array $name:
If a string, the element name. If an array, all other parameters are ignored, and the array elements are extracted in place of added parameters.

Or it could be the way the query is setup in getPropFlags(). I’m not sure what I’m doing wrong. I have been looking at this for a while and running out of ideas. Any help would be great.

  • 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-12T09:30:56+00:00Added an answer on June 12, 2026 at 9:30 am

    Change it to:

    $result = $oSql->fetchAll($oSelect)
    
    $options = array();
    foreach($result as $k => $v) {
        $options[$v['f']] => $v['value'];
    }
    
    return $options;
    

    Do some var_dumps to compare the arrays. You need a simple key/value pair array.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a dropdown menu populated from a table in a MySQL database. It
I have a dropdown menu that pulls in text from a database column. The
I have a dropdown menu bounded with values from the db on form load.
I have a dropdown menu that I am using and can't quite get it
I have a dropdown menu on a website that works perfectly on all browsers
I have a dropdown menu that is filled by a mysql database. I need
I have a little dropdown menu similar <select> , which contolled from external js-function.
I have a HTML dropdown menu where I want to pass the selected values
I have have this dropdown menu where you can select multiple values. Now let's
I have a dropdown menu with a couple of values that link to functions.

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.