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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:18:30+00:00 2026-05-16T07:18:30+00:00

I currently have an array I created like this: $regions=array( 1=>’North West’, 2=>’North East’,

  • 0

I currently have an array I created like this:

$regions=array(
    1=>'North West',
    2=>'North East',
    3=>'South West',
    4=>'South East',
    5=>'West Midlands',
    6=>'East Midlands',
    7=>'London',
    8=>'Yorkshire',
    9=>'East England',
    10=>'Scotland',
    11=>'Wales',
    12=>'N. Ireland',
);

I will use this array to generate dropdown list options (value=>text) in my form. The selected option value will be stored in the database in an integer field.

This might just be a matter of personal preference, but I was just wondering whether this is the correct approach? Or should the array key be the same as its value? Could there be any potential problems further down the line (adding/deleting/modifying the array) when using this approach?

  • 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-16T07:18:31+00:00Added an answer on May 16, 2026 at 7:18 am

    I tend to stored the key value in this instance. However I would normally store the regions in a lookup table where the id and values are stored so any future modifications can be managed relatively easily using foreign keys etc.

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

Sidebar

Related Questions

I have an object that looks like this when outputted via a print_r Array
I would like to provide all mathematical functions for the number-like objects created by
I have created a simple WordPress plugin that automatically sets my new sites up
I am currently trying to use AJAX in my application via jRails. I am
I'm trying to improve performance for my application, and I'd like to change from
I'm working on building an HTTPHandler that will serve up plain text for use
I found the jQuery Cycle plugin which is very interesting. So, there is the
I was pretty surprised when I discovered that there is no direct way to
Our desktop application consists of a Mono/.NET 3.5 back end that communicates via USB

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.