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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:38:19+00:00 2026-06-11T03:38:19+00:00

I create an array of numbers for ordering a gallery. I wanted to know

  • 0

I create an array of numbers for ordering a gallery. I wanted to know if there was a way to have the dropdown default to the last item instead of the first? So with the example code when the page loads it would have the 6th element (value 5) selected as default.

<php? // Codeigniter that generates the select dropdown.
form_dropdown('order', $order);
?>

<select name="order">
    <option value="0">1</option>
    <option value="1">2</option>
    <option value="2">3</option>
    <option value="3">4</option>
    <option value="4">5</option>
    <option value="5">6</option>
</select>
  • 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-11T03:38:20+00:00Added an answer on June 11, 2026 at 3:38 am

    With your update, I am assuming you want to achieve the result below with the CodeIgniter form_dropdown() function?

    <option value="5" selected="selected">6</option>
    

    What you would have to do is add a few parameters to the function like this:

    echo form_dropdown('order', '', '5');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a fiddle code: //create array with values thisArray= ['',[]]; thisArray[0] = ['numbers',['one','two','three','four','five']];
I have an array of numbers and I'd like to create another array that
I want to create an array of numbers: 10, 9,8...to 1. But when I
I have create an array containing person firstname,lastname and number which i populate in
I'm supposed to create an array and sort the numbers from smallest to largest.
I want to create an array of numbers from 0-9 and want them to
I need to create one array of numbers inside one range, like: [1..5] in
I have a method that sorts an array of numbers in ascending order and
I have to create an array of linked lists for a class in order
I need help understanding the easiest way to create an array which carries 4

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.