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

  • Home
  • SEARCH
  • 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 6949273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:55:57+00:00 2026-05-27T13:55:57+00:00

echo $form->dropDownList( $model,’categoryId’, CHtml::listData(Category::model()->findAllBySql( ‘SELECT * from category where isnull(parent_id)’), ‘id’, ‘name’), array( ’empty’=>Yii::t(‘fim’,’Search

  • 0
echo $form->dropDownList(
              $model,'categoryId', 
                      CHtml::listData(Category::model()->findAllBySql(
                      'SELECT * from category where isnull(parent_id)'), 
                      'id', 'name'), 
                      array(
                            'empty'=>Yii::t('fim','Search All'),
                             Yii::t('fim','Jobs'), 
                             Yii::t('fim','Training'), 
                             Yii::t('fim','Events'), 
                             Yii::t('fim','News')
                      )
            );

Jobs, Training, Events and News are not appearing.

How can/should we build this, in order to add those values to the select box ?

Thanks

  • 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-05-27T13:55:58+00:00Added an answer on May 27, 2026 at 1:55 pm

    You cannot add static elements by using the $htmlOptions parameter. Here is how I do it:

    $data = CHtml::listData(Category::model()->findAllBySql(
                            'SELECT * from category where isnull(parent_id)'), 
                            'id', 'name');
    // Add extra options here: I am actually prepending with this syntax,
    // but you are free to append or interleave instead. Array keys are the values.
    $static = array(
        'jobs'     => Yii::t('fim','Jobs'), 
        'training' => Yii::t('fim','Training'), 
        'events'   => Yii::t('fim','Events'), 
        'news'     => Yii::t('fim','News'),
    );
    
    echo $form->dropDownList(
        $model,
        'categoryId',
        $static + $data,
        array('empty'=>Yii::t('fim','Search All')));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I write this from in Codeigniter as a form_view.php . <?php echo form_open('form'); ?>
$x=array('a','b','c'); echo form::dropdown('test', $x, 'b'); I'm using the Kohana form helper to build forms,
Imagine this simple form <form action=<?php echo $_SERVER['REQUEST_URI']; ?> method=post> <fieldset> <legend>Contact Me</legend> <label
I can't figure out why... This works: <?php if($_POST['test']) echo posted; ?> <form method=POST
Please see my question in the template section below: Form (showSuccess): <?php echo form_tag('job/salarySubmit')
I display the form validation error in codeigniter as below: <?php echo form_error('name', '<div
$sql = SELECT DISTINCT Branch FROM student_main; $result = mysql_query($sql); $row_num = mysql_num_rows($result); $rows
What I am trying to do is this: When I select color from dropdown
I used this function to start a form: echo form_open('email/send'); and after viewing the
I have a form that pulls data from a database. Code works fine if

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.