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

The Archive Base Latest Questions

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

I use the ion auth for codeigniter and it works great except that I

  • 0

I use the ion auth for codeigniter and it works great except that I don’t know how to code drop down list the same way as the text field.

If you want to display a text field under view you have to issue this:

<?php echo form_input($first_name);?>

And this is the code under controller:

$this->data['first_name'] = array(
    'name'      => 'first_name',
    'id'        => 'first_name',
    'type'      => 'text',
    'size'      => 32,
    'maxlength' => 32,
    'value' => $this->form_validation->set_value('first_name'),
);

But how can I put the value of my drop down list into an array?

I tried putting this code under view:

<?php
$options = array(
                  ''    => 'Select',
                  'Dr'  => 'Dr.',
                  'Mr'  => 'Mr.',
                  'Mrs' => 'Mrs.',
                  'Ms' => 'Ms.',
                  'Prof' => 'Prof.',
                  'Mr. & Mrs.' => 'Mr. & Mrs.',
                );
echo form_dropdown('title', $options, '$title');
?>

I am thinking that under view I should code it like: echo form_dropdown($title); the same as text field but what is the code under controller?

  • 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:43:01+00:00Added an answer on June 10, 2026 at 2:43 am

    First in your controller you can do :

    $options = array(
                  '0'    => 'Select',
                  'Dr'  => 'Dr.',
                  'Mr'  => 'Mr.',
                  'Mrs' => 'Mrs.',
                  'Ms' => 'Ms.',
                  'Prof' => 'Prof.',
                  'Mr. & Mrs.' => 'Mr. & Mrs.',
                );
    $data['options'] = $options
    $this->load->view('your_view',$data);
    

    In the View :

    echo form_dropdown('title', $options, set_value('title'));
    

    Moreover think you want to retain the value of the dropdown if a form validation error occurs:

    you just need to put some validation to retain the values of the dropdown , somethin like:

    $this->form_validation->set_rules('title','Titles','alpha');
    

    If not validatted the dropdown will not retain the values in spite of using set_value

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

Sidebar

Related Questions

use Modern::Perl; use Algorithm::Permute; use List::AllUtils qw/uniq/; find_perms(1151); sub find_perms { my ($value) =
What can I do to ensure that replication will use latin1 instead of utf-8?
I am currently developing a website with the help of codeigniter and the ion
I'm using the Ion Auth library for the authentication system in a website I'm
I am trying to consistently use the same dimension in all the views in
I'm trying to use the following code to show one intent if the record
I'm sure a lot of people use the twitter widget that twitter provides. Here's
I would like to create a interface that I can use with different types.
So. I created a custom WordPress taxonomy. And I have multiple posts that use
I want to use Haskell to solve a financial combinatorial problem, the list monad

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.