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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:31:25+00:00 2026-05-26T06:31:25+00:00

I have a php file that contains switch/case which is in JSON I believe.

  • 0

I have a php file that contains switch/case which is in JSON I believe.
Please excuse me on my knowledge of php/ajax/json, really trying to learn this.

<?php
    switch($_GET['make']) {
        case "Acura":
            echo json_encode(array("MDX","RDX","RL","TL","TSX","ZDX")); 
            return;

        case "Audi":
            echo json_encode(array("A3","A4","A5","A6","A8","Q5","Q7","R8","S4","S5","S6","TT","TTS")); 
            return;
    } 
?>

This is the file I have, it has all makes/models. How would I go about creating a drop downlist that shows all makes,”Acura,”Audi”, then have a second dropdown that would populate with models. If I selected Acura, the second dropbox would show MDX, RDX, RL, TL, TSX, ZDX

http://whodateswhere.com/auto/
I have the dev site set-up here but it’s not functional. How would I be able to make it work on my site?

Thanks for your help!

  • 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-26T06:31:25+00:00Added an answer on May 26, 2026 at 6:31 am
    $('#ajax_make_id').change(function(){
        $.get('model.php',{ make: $(this).html() }, function(data){
            $drop_down_data = get_options( $.parseJSON(data) ); 
            $('#ajax_model_id').html( options ); 
        }); 
    }); 
    
    function get_options( options_array )
    {
        var options = ''; 
        for( var i in options_array )
             options += '<option value="'+ options_array[i] +'">' 
                        + options_array[i] +'</option>'; 
        return options; 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ajax.php file that contains the following sample code: switch($_REQUEST['request_name']) { case
I have a php file that contains a form (which contains 2 input boxes
I have a php file that contains class which runs some lengthy database operations.
I have a PHP file that contains a form and which submits back to
I have a PHP file that contains a lot of if and else statements
I have a php file somejson.php that echos a json encoded array {jsonone:first json,jsontwo:second
I have a directory named dollars that contains a file index.php . I would
I have a php file that contains a HTML form, then PHP logic, then
I have an config.php file where I simply make an huge array that contains
I have a coreFunctions.php file that contains most of my key functions and I

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.