populating listbox by selecting info from other listbox

I am using php on oracle. Using OCI functions I am able to query the table and populate the first list box. How to populate second listbox by selecting option from first listbox and using the same option to populate second listbox by quering another table without refreshing the page?
shylajaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

maxkirCommented:
You have to pre-query all possible selections from first listbox and build a lot of Javascript code to change contents of second listbox basing on selection from first listbox. All possible contents for second listbox must be coded in Javasript code, which is, in turn, generated by PHP. IMO, not very simple task - you have to change listbox contents via Javascript.

The main point - u have to build a lot of javascript code using PHP code.
0
jasmoft146Commented:
Max is right, however, you can make the task simpler on yourself.

First you take the results of the querys and put each into its own file.

Here's what to do:
in PHP:
While you still have more queries
 query your db
 save the results into a file
go back to top

//Name the files so that the first item in the select box corispondes to the Q0.js; The second item corispondes to Q1.js.

Write the results in the format:
document.write ('<option> $ReturnValue[x] \n'

Then put the options of the second select box in a div with an ID.

<head>
<Script>
function Change(index){
DIV.innerText='<script language="Javascript" src="Q' + index + '.js">'
</Script>
</head>
.....

<select onchange="change(this.selectedIndex);">
.....
<Select ....>
<div ID="DIV">
</Div>
</select>
0
maxkirCommented:
Hello?
Did these comments help you ?
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

shylajaAuthor Commented:
Thanks a lot maxkir. Your suggestion worked out.
0
maxkirCommented:
OK, then you'll probably give me some points ? ;-))
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jasmoft146Commented:
Well, maxkir, you were the first in; however, I must have missed where you posted your code to show how to do it.  I believe you only said that it would take lots of javascript, and neglectied to show how it can be done.
0
maxkirCommented:
jasmoft146,
I'm sorry, but the question was how to do it, i.e. the idea. The question wasn't "Give me some example" - so i didn't offer the code.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.