select box in php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
eamewoto
Forum Newbie
Posts: 1
Joined: Mon Mar 24, 2003 8:30 am

select box in php

Post 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
User avatar
mchaggis
Forum Contributor
Posts: 150
Joined: Mon Mar 24, 2003 10:31 am
Location: UK

Post 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.
User avatar
daven
Forum Contributor
Posts: 332
Joined: Tue Dec 17, 2002 1:29 pm
Location: Gaithersburg, MD
Contact:

Post 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
Post Reply