[Zope-dev] Newbie SQL Question

Christopher Petrilli petrilli@digicool.com
Tue, 10 Oct 2000 13:05:00 -0400


On 10/10/00 11:33 AM, "Yvonne Totty" <ytotty@atinucleus.com> wrote:

> HI!
> 
> I am having a slight newbie problem and for the life
> of me cannot find any references for how to do it.
> 
> I have input boxes on a page. I want the information
> from that box to be input into a database table upon
> clicking the Submit button.
> 
> I cannot figure out how to get that information from
> point 'A' to point 'B'.

Assuming your form has a field named the same as all of columns you want to
insert (i.e. Foo, bar, whatever)... Then you can have it post to another
method that has a line like this in it:

    <dtml-call name="sqlInsertValues">

And then have a SQLMethod called 'sqlInsertValues' that has a body like
this:

    INSERT INTO mytable (
        column1,
        column2,
        column3 ) VALUES (
        <dtml-sqlvar name="column1" type=string>,
        <dtml-sqlvar name="column2" type=int>,
        <dtml-sqlvar name="column3" type=string> )

Remember to put these in the arguments list, or they won't be caught from
the REQUEST namespace.

Chris 

-- 
| Christopher Petrilli                                     Digital Creations
| petrilli@digicool.com                                Where Zope comes from