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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:54:14+00:00 2026-06-05T06:54:14+00:00

I am building a site with a select tag that has all 50 states.

  • 0

I am building a site with a select tag that has all 50 states. I want to be able to have a page generated for each state selected rather than having to write 50 separate pages. Any ideas on how I would accomplish this? Thank you.

  • 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-05T06:54:19+00:00Added an answer on June 5, 2026 at 6:54 am

    You can either load all data on page load, or via ajax, and only show the data for the current state,

    or if you have a server side database/data source to pull the data from you could also just have the page deliver data for a specific state, defined by a query/GET variable, the URL would look something like:

    http://mysite.com/myPage.aspx?state=ca

    or

    http://mysite.com/myPage.php?state=az

    When the page is requested you can then have your server page populate the correct data for the current state, which would then be sent over to the client.

    Generally speaking I would lean toward the server side solution, especially if your visitors will likely only visit a handful of states then there’s no reason to load ALL states data. On the flip side if the data for each state is very minimal it might not make much different either way.

    EDIT

    I’m not aware of any specific tutorials on the web, but since this encompasses putting a few things together I’ll tell you the topics that might be useful in accomplishing this.

    Depending on your level of knowledge of php, or c#, or other chosen language for your server side part, research the following topics:

    1. Read a Get variable
    2. Switch case statements
    3. Add variable value into parts of html, or concatenation of html strings
    4. Optionally various database topics, (if you don’t want to hard code
      data into your code)

    For example, your server side php page could look something like this (untested code):

    <?php
    switch($_GET["state"]) {
      case "ca":
        $pageTitle = "California";
        $pageContent = "stuff about CA";
        break;
      case "az":
        $pageTitle = "Arizona";
        $pageContent = "stuff about a really hot state";
        break;
        ...
    }
    
    ....
    
    echo '<h1>' . $pageTitle . '</h1>' . '<p>' . $pageContent . '</p>'; 
    
    ?>
    

    Along with that you’d want to handle when the visitor selects a different state, and upon selection of a state load the correct page. With jQuery you could do something with the change() method.

    in your html body declare you drop down list (select input) with id=”stateSelectDropDown”, then in your javascript (untested code):

    <script type="text/javascript">
      $(function() {
        $("#stateSelectDropDown").change(funciton() {
          window.location = "nameOfThisPage.php?state=" + $(this).val();
        });
      }
    </script>
    

    I apologize for any typos or bad syntax, I hope this points you in the right direction.

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

Sidebar

Related Questions

I am building a site that has a page where I display some products
I am building a site that will (obvisouly) have a front end public portion
I'm building a web-app that allows people to select their US state from a
I have this selectbox on a site Im currently building and what I want
building a site using PHP and MySQL that needs to store a lot of
I'm building a site in django that interfaces with a large program written in
I'm building a site with django that lets users move content around between a
We are building a site, and have no interest in creating multiple themes. We
We are building a site using asp.net mvc. We want to allow the user
I'm building a site using symfony php framework. I have a link in my

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.