Page 1 of 1

select box in php

Posted: Mon Mar 24, 2003 8:30 am
by eamewoto
Hi there,
I have 2 select boxes(box1&box2) and a text field. I am doing a search. I enter the search data into the text field. And the search result is used to populate the select box1. The box1 values( which contain search result) are moved into select box2. I want to repeat the search several times without losing the values that are initially in the select box2. In other word I don't want to refresh the page anytime I do the search.
Can you please assit.
Emile

Posted: Mon Mar 24, 2003 10:46 am
by mchaggis
What you ask is not exactly possible, as to perform a search the form would need to be submitted, therefore refreshing the page.

Also, using javascript doesn't allow you to edit the contents of dropdown boxes once the have been created (recieved by the browser). One alternate is to use DHTML/layers, but I couldn't tell you how to do this and it would still need some form of sending data, thus refresh.

If you make the page with the form on, as small as possible (bytes wise not screen ;)), then the user will not really notice, depending on the time taken to do the server side search.

Posted: Mon Mar 24, 2003 12:51 pm
by daven
Actually, you can use JS to change the contents of a select box. However, you cannot perform a search without reloading (sending info to PHP).

viewtopic.php?t=6568

Code examples as to repopulating dropdowns