From: "Robb Kerr" <[EMAIL PROTECTED]>

> Searched all the sites I could find for this problem to no avail. I have
> two dropdown menus in a form. The first menu contains a list of
> MANUFACTURERS obtained from a database. The second contains a list of
> MODELS also obtained from the database. I want the second menu to be
> populated based upon the selection in the first. In other words, once a
> visitor has selected a MANUFACTURER they'll be presented with a list of
> MODELS that are available from the selected MANUFACTURER.
>
> I know how to do the queries, but don't know how to initiate the query and
> rebuild the second menu when the first selection is made without adding a
> SUBMIT button and loading a second page.
>
> Anyone know how to accomplish this? Thanx in advance.

This is a pretty common question. You need to employ some Javascript to get
this to work the way you want it to, though.

To do this purely in PHP, then the SUBMIT button required, as PHP cannot
change the client side form elements, only the source code sent to the
browser.

That said, you can use your queries in PHP to build the Javascript variables
/ arrays. As you loop through the query results, you create the arrays with
all of the possible MODEL values. Then when your user selects a
MANUFACTURER, the javascript reads the arrays that PHP wrote into the source
code and loads the appropriate one into the MODEL select box.

Keep searching, examples are out there.

---John Holmes...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to