[ic] Improving my search form
DB
DB at M-and-D.com
Fri Feb 5 17:49:10 UTC 2010
I have a table with the following columns:
Code, Brand, Model, SKU
I want a form with two dropdowns... one where the Brand is selected and
another where the Model is selected. When a choice is made in the Brand
dropdown, I want only the models associated with that brand to be shown
in the Model dropdown.
What I have now (shown below) works, but the Model dropdown shows ALL
models, not only those associated with chosen option of the Brand dropdown.
Can anyone suggest a remedy? I could use a 2-page approach but that's
also a bit crude. I suspect this is fairly simple to do but I've not yet
found the answer.
<form action="[area results_sql]" method=post>
<input type=hidden name=mv_session_id value="[data session id]">
<big>First, Choose Your Machine's Brand</big><br>
<select name="machinebrand">
[query
type=list
sql=|
SELECT distinct brand
FROM brandmodel
ORDER BY brand
|]
[list]
<option value="[sql-param brand]">[sql-param brand]
[/list]
[/query]
</select>
<big>Then Choose Your Machine's Model</big><br>
<select name="machinemodel">
[query
type=list
sql=|
SELECT distinct model, brand
FROM brandmodel
ORDER BY brand, model
|]
[list]
<option value="[sql-param model]">[sql-param brand] - [sql-param model]
[/list]
[/query]
</select>
<input type="image" alt="Search" src="go.gif" border=0>
</form>
Any thoughts are welcome.
DB
More information about the interchange-users
mailing list