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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:51:04+00:00 2026-06-14T04:51:04+00:00

I have an HTML listbox, I want to be able to select any value

  • 0

I have an HTML listbox, I want to be able to select any value in that listbox and update a second listbox with a PHP database query based on that selection.

Options I have tried:

-I have tried using JSON. I update the second listbox using Javascript and calling an external PHP script, but the returned PHP value would be an array and that wont convert well with Javascript.

-I am not able to use cookies, so I use HTML Sessions. When you select a value in the first listbox it updates a session value and refreshes the page. Upon reload, the page does a PHP script using the Session value to update the second listbox, but I cant update the HTML Session with the selected value of the first listbox using Javascript by calling onChange=”function(); with the first listbox”.

Is there any other available options to implement this? Or how can I fix one of these options to make this work?

  • 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-14T04:51:05+00:00Added an answer on June 14, 2026 at 4:51 am

    You say that you’ve tried using JSON, but you clearly don’t completely understand what that means. JSON is simply a way of formatting strings that can be understood universally by any machine which has a parser for it. The idea that the PHP value is an “array” and therefore unconvertible makes no sense; all that matters is that it’s sent to the client in JSON format.

    If you have an array in PHP, you can convert it to JSON format using the json_encode function:

    <?php
    my_arr = array('a' => 'b', 'c' => 'd');
    // do stuff to fill array
    echo json_encode($my_arr);
    ?>
    

    When you receive it in JSON format in your JavaScript code, you can then parse it into a JavaScript object – see this question for details.

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

Sidebar

Related Questions

I have an html listbox : <select id=test size=5> <option value=1>1</option> <option value=2>2</option> <option
My scenario is this: I have two listbox's, one that contains all my database
I have a page that I load a select dropdown box but I want
I would like to make a multiple selection listbox in HTML that can have
I have the following html element <select id=selectStates size=5 multiple=multiple class=box> <option value=tx>Texas</option> <option
I have a html form which have a select list box from which you
I have html that is dynamically created when I bind my gridview to a
I have html that looks like this with several items <div class=item> <p class=price>$388.00</p>
So if you have a html List Box, also called a multiple select, and
I have an HTML table with rows (20 rows). Every row has a listbox

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.