[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] How to send input from a form page to a SQL query page?
> I am trying to create a search form that will produce a list from a large
> MySQL alternate products table.
>
> In my search page:
>
> <form action="[area results-sqltest]" method=post>
> <input type=hidden name=mv_session_id value="[data session id]">
> <INPUT NAME=keyword type=text size=8>
>
> <input type="image" alt="Search Go" width="45" border="0"
src="__THEME_IMG_DIR__go.gif">
>
Let's start with that.
Change your form action to be [process-target] instead of
[area results-sqltest]. Add some more "hidden" <input> directives,
along with your mv_session_id, as follows:
<input type="hidden" name="mv_nextpage" value="results-sqltest">
<input type="hidden" name="mv_todo" value="return">
>
> The results-sqltest.html page:
>
> [query sql="select * from sqltestdatabase
> where prod_group = 'Toys'
> and category = 'Beanie Baby'
> and description = ?????????? <----WHAT DO I NEED TO PUT HERE FOR IT TO WORK?
> type=list
> ml=1000]
> [list]
> ...
> [/list]
> [/query]
>
Your form value is called "keyword" on the first page, so you can
refer to it as [value keyword] here. Put it in quotes for the SQL
to be valid. Following your example:
[query type=list ml=1000 sql=|
SELECT description, category, price
FROM sqltestdatabase
WHERE prod_group = 'Toys'
AND category = 'Beanie Baby'
AND description = '[value description]'
|]
[list]
Product: <b>[sql-param description]</b><br>
<i>Category: [sql-param category]</i>
Our Price: [currency][sql-param price][/currency]
[/list]
[/query]
Hope that helps a bit.
--
_/ _/ _/_/_/_/ _/ _/ _/_/_/ _/ _/
_/_/_/ _/_/ _/ _/ _/ _/_/ _/ K e v i n W a l s h
_/ _/ _/ _/ _/ _/ _/ _/_/ kevin@cursor.biz
_/ _/ _/_/_/_/ _/ _/_/_/ _/ _/