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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:30:43+00:00 2026-06-14T21:30:43+00:00

I am thinking about two drop down list, one is depended on another. Both

  • 0

I am thinking about two drop down list, one is depended on another. Both drop down list have values from database. In this case which one is the best way.

  1. Retrieve all values from database using plain PHP then store them in javascript variable, later search for second drop down list value (if first drop down list’s value changes)in the javascript (array) variable.

  2. If first drop down list’s value changes then retrieve values for second drop down list from database using AJAX(jQuery).

  • 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-14T21:30:44+00:00Added an answer on June 14, 2026 at 9:30 pm

    The two alternatives that you’ve indicated has pros and cons, the decision depends on how this pros and cons affects your application:

    Retrieve all values from database using plain PHP then store them in
    javascript variable, later search for second drop down list value (if
    first drop down list’s value changes)in the javascript (array)
    variable.

    Pros:

    • Minimizes the http petitions, you only need one petition to retrieve the whole data.
    • Minimizes the query’s needed against the database, generally you only perform one query.

    Cons:

    • Increases the amount of memory used if you have big amounts of data.
    • If your data changes constantly, your visitors don’t see the changes until it refresh the whole page.

    If first drop down list’s value changes then retrieve values for
    second drop down list from database using AJAX(jQuery).

    Pros:

    • You don’t need to store all the whole data in memory, only the data that will be used, reducing the amount of memory needed.
    • Your data is updated every time without the need of reload the page, only changing the selection.

    Cons:

    • You need to perform several http petitions and runs querys against the database every time the selection changes.

    Personally I prefer method 2 if the amount of data is relatively big and the performance is not a must.

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

Sidebar

Related Questions

I'm thinking about a database design that will have two tables Members and Groups.
I have two rails apps that I am thinking about merging into one because
Question I have two compilers on my hardware C++ and C89 I'm thinking about
I have two tables which look kind of similar and I was thinking about
I have been thinking about this for a while and cannot come up with
I feel like I'm thinking about this two hard and the solution should be
I have been thinking about two questions. Couldn't find any resources on the internet
Been thinking about this for hours now. Im building a simple slideshow application, where
Just thinking about the best way to build an Order form that would (from
I'm thinking about it, which of the following two query types would give me

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.