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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:44:30+00:00 2026-05-25T11:44:30+00:00

I know how to create a drop down list, however if you had to

  • 0

I know how to create a drop down list, however if you had to create a form where one of the input is a state (a two letter word) in a drop down list, do I just input the state one by one or should I store the state in a DB?

  • 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-25T11:44:31+00:00Added an answer on May 25, 2026 at 11:44 am

    This is kinda weird question. Depending on your project of course.

    If you need performance and speed, when loading your dropdown list (I’m assuming you meant <select />). Then you might want to put them into a separate .php file in an array form. So later on you could just loop them with foreach(). This method will surely load faster, then to load 50 states from DB.

    inc-states.php:

    $states = array(
        1 => 'Alabama',
        2 => 'Indiana',
        3 => 'Nevada'
        // etc..
    );
    

    Generate form:

    echo '<select name="states">';
    foreach ($states as $key => $state) {
        echo '<option value="' . $key . '">' . $state . '</option>';
    }
    echo '</select>';
    

    So after posting you will only save the keys. Later on you can again get the right state via the key:

    include('inc-states.php')
    
    $user['state'] = 2; // Lets make a default for this example
    
    print $states[$user['state']]; // outputs Indiana
    

    Same basic idea remains with the DB method as well. Only this is probably faster.. Unless of course you want to be able to edit the states via some sort of admin console.

    NOTE: You in fact said two character shortcodes only, but my example array looks prettier with full titles. Anyways, as you probably know, you can put the states in whatever format in the array.

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

Sidebar

Related Questions

I want to create a form something like this on my drop down list.
Does anyone know if there is a CheckBox List for a Drop Down List
I want to create a drop down list on the Mozilla browser which is
i have a registration form which contains a postalcode and a country drop down
I have a View Feedback page with two drop down lists to filter the
How do I create a new usermeta field with a drop down selection values?
I know how to create a SEL at compile time using @selector(MyMethodName:) but what
Anyone know how to create a routed event in Silverlight 2? In WPF, the
I know the statement: create table xyz_new as select * from xyz; Which copies
I know how to create a custom user control in WPF but how can

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.