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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:22:50+00:00 2026-06-10T13:22:50+00:00

I have the following ajax snippet that chains 2 select boxes and is populated

  • 0

I have the following ajax snippet that chains 2 select boxes and is populated dynamically using values found in a mysql table.

This works great if the callType column is a numerical value like what is found in my data column SPG_CallType. When I change this to use a column that contact alphabetical letters it breaks it. I am assuming this is because the code works for just numerical values? How do I update that part of the snippet to accept either alpha or numeric?

if (isset($_GET['key'])) {
    $key = $_GET['key'];
    switch ($key) {
        case 'callTypeSelect':
            $select = new SelectBox('Repair Type?','Choose a category');
            $res = mysql_query('SELECT DISTINCT SPG_CallType FROM ' . DB_TABLE . ' ORDER BY SPG_CallType ASC');
            $callTypes = array();
            for ($i = 0; list($callType) = mysql_fetch_row($res); $i++) {
                $callTypes[] = $callType;
                $select->addItem($callType, 'brandSelect-' . $callType);
            }
            header('Content-type: application/json');
            echo $select->toJSON();
            break;
        default:
            if (strpos($key, 'brandSelect-') === 0) {
                $callType = str_replace('brandSelect-', '', $key);
                $resBrands = mysql_query('SELECT SPG_Brand FROM ' . DB_TABLE
                    . ' WHERE SPG_CallType = ' . mysql_real_escape_string($callType) . ' ORDER BY SPG_Brand ASC');
                $select = new SelectBox('Choose a Manufacturer', 'Pick a brand');
                for ($i = 0; list($brand) = mysql_fetch_row($resBrands); $i++) {
                    $select->addItem($brand, 'result-' . $brand . '-' . $callType);
                }
                header('Content-type: application/json');
                echo $select->toJSON();
  • 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-10T13:22:51+00:00Added an answer on June 10, 2026 at 1:22 pm

    @roryok answered the question, no way to give credits to comment though?

    $select->addItem('\'' . $callType . '\'', 'brandSelect-' . $callType);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following simple jquery snippet $(document).ready(function () { $.ajax({ url:myjson.json, dataType: 'json',
I have the following Javascript snippet that receives an customerID via parameter (i'm going
I have the following javascript snippet: $.ajax({ url: self.LoadCirculationListUrl, cache: false, async: false, dataType:
I have the following code snippet: $(d).ready(function() { $.ajax({ url : http://localhost:8080/ProjTest/TestServlet, type :
I have the following ajax call inside an .each loop, that loads several .swf
I have the following ajax call var prev_sibling = $(this).prev().attr(value); var next_sibling = $(this).next().attr(value);
I have the following code: $.ajax({ async: false, url: 'chart_data.php', data: {'option':'high', 'id':id}, dataType:
I have the following code: $.ajax({ type: 'GET', url: 'index.php?route=checkout/onepagecheckout/getpaypaldata', dataType: 'json', success: function(json)
I have the following jQuery $.ajax({ type: GET, url: http://f.cl.ly/items/0i1V1L1k2F440L1m2Y0G/pointdata.xml, dataType: xml, success: parseXml
I have the following piece of code: // setup the AJAX request var pageRequest

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.