[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Creating and processing forms that access a database
I thought that I had figured out how to use MiniVend, but I'm trying
to accomplish something seeming simple, and getting nowhere fast.
I have to use MiniVend for a task that I know how to accomplish with
CGI: Submitting a form to the server, and having a CGI program
retrieve the form elements, use them to query an SQL database, and
give the results to the user.
Specifically, I would like to know two things:
(1) What is the generic way for me to create a form that is processed
by a MiniVend template of my choosing? That is, I would like to
create MiniVend template form.html, whose "submit" button passes
the HTML form elements to MiniVend template results.html. I have
been playing with forms, the "mv_doit" hidden tag, and and the
[value] MiniVend template tag, without much success.
So, how do I duplicate CGI functionality with MiniVend? I don't
care about the underlying technology, but it's frustrating not to
know how to pick out form elements.
Must I got through the "search" program? What does that gain me?
(2) I know that MiniVend's query engine is supposed to handle most or
all of the SQL queries that I might like. But I would like to
give users a choice of <select> fields in an form, and then
perform an OR match on them. That is, I would like the resulting
SQL query to look like
SELECT id, product_name
FROM Products
WHERE product.region = 1
OR product.target_population = 2
OR product.price = 3
If I use mv_searchfield and mv_searchspec, then it would seem that
MiniVend always performs an AND search. I want users to be able
to create an arbitrarily loose or tight search, narrowing things
as necessary by choosing more elements from <select> lists.
Any ideas? I have been reading the documentation for days, and cannot
find an obvious solution to either of the above.
Reuven