Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

php & javascript -intresting question

Status
Not open for further replies.

kenguru

Programmer
Joined
May 14, 2004
Messages
173
Location
RO
Hello,
I have two pages: on php and on ihtml.
In the php page i have two select, and the data are put in a list box. In the ihtlm page i make a reference to the php page.
My question would be: how it is possible to use the first select stateman as a filter for the second. I know that i have to reload it, I thought that i could try with Javascript.
Does anyone have any suggestion?
Thank's
Erika
 
It can be done.

What I generally do is write a script that produces a form that submits back to the script.

If the script is run with no input (it can know by checking for the names of the form fields it produces) then it produces a form with a single SELECT.

If it gets input from one SELECT, it produces a form with two SELECTs, the first with the data originally displayed and the user's selection pre-selected and the second with the options available based on the value of the first input.

If the script gets input from two SELECTs, it processed the data then directs the browser to another page.

All of the SELECT tags in the above example will have their "onchange" attributes pointing to the JavaScript code necessary to submit the form automatically.

You do, however, need to provide SUBMIT buttons for those users that have JavaScrit turned off in their browsers.



Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Hi,
I tried the following. I used the "onchange" event:
onchange="window.location.reload()"
The site imediatly updates it self, but the value of the drop down list is loast, so I can't use it in the following drop down box as a "where" condition:((
BYe,
Kenguru
 
I think you need to submit the form, not reload the page. But questions about the nitty-gritty details of JavaScript are better reserved for the JavaScript forum.



Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top