[ic] form process before query??

Ed LaFrance interchange-users@icdevgroup.org
Sat Jul 6 10:37:02 2002


At 11:43 AM 7/5/2002 -0700, you wrote:
>At 09:43 AM 7/5/2002 -0700, you wrote:
>>Hi
>>
>>I am trying to complete a sql query with a cgi form variable, then process
>>the form. Here is what I have:
>>
>><FORM ACTION="[process-target]" METHOD="POST" name=invite>
>><INPUT TYPE=hidden NAME=mv_session_id VALUE="[data session id]">
>><INPUT TYPE=hidden NAME=mv_todo VALUE="return">
>>
>>    [query
>>         ml=30
>>         type=list
>>         sp="@@MV_PAGE@@"
>>         sql=|
>>             SELECT  boxname
>>             FROM    mb_boxlist
>>             WHERE   username = '[data session username]'
>>             AND     boxname != 'main'
>>             ORDER BY boxname
>>         |]
>>               <SELECT NAME=c_box>
>>               [list]
>>               <OPTION VALUE="[sql-param boxname]">[sql-param boxname]
>>               [/list]
>>               </SELECT>
>>           [/query]
>>
>><input type="text" name="c_name" value="">
>><input type="text" name="c_email" value="">
>><TEXTAREA WRAP="virtual" ROWS="4" COLS="35" name="c_comm"
>>value=""></TEXTAREA>
>>
>>[button
>>         form=invite
>>         text="Send"
>>           src="__BUTTON_DIR__/change.gif"
>>           hidetext=1
>>         align="right"
>>         ]
>>
>>[if cgi c_email]
>>
>>    [query
>>      ml=1
>>      sp="@@MV_PAGE@@"
>>      type=list
>>      sql=|
>>             SELECT  password
>>             FROM    mb_boxlist
>>             WHERE   username = '[data session username]'
>>             AND     boxname = '[cgi c_box]'
>>           |]
>>      [list]
>>       <input type=hidden name="c_pass" value="[sql-param password]">
>>      [/list]
>>    [/query]
>>
>>  mv_nextpage=c_invite
>>
>>[/if]
>>[/button]
>>
>>     </form>
>>-----------------------------------------------
>>
>>I thought maybe lowering the mv_nextpage would do it, but it does not. Or
>>wrapping it in an [on-match] pair. I have tested all queries, and they do
>>work as written. I am thinking it is some positional thing that I do not
>>understand. mv_todo=return seems like it is the things to do, but what am I
>>missing?
>>
>>I need the query to make the hidden input, and include it in the form
>>submission. The -- type=hidden name="c_pass" -- is the only thing I can't
>>pass :(
>>
>>Paul
>
>In order to run SQL using CGI variables, you have three options:
>
>  * mv_click
>  * mv_check
>  * on the next page
>
>Of course, the first two do not display output.  So try putting your SQL 
>code on the page this goes to (apparently 'invite') and see what 
>happens.  (Or you can put it in a mv_check, store the output, and then 
>display it).
>
>+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>| Dan Browning, Kavod Technologies <db@kavod.com>
>+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Another problem with your form is that vars assigned by the button tag are 
written out as name=value pairs in an mv_click, not as hidden form inputs. 
So, assuming it would work they way you want, which is questionable, your 
button tag should be:

[button
         form=invite
         text="Send"
           src="__BUTTON_DIR__/change.gif"
           hidetext=1
         align="right"
         ]

[if cgi c_email]

    [query
      ml=1
      sp="@@MV_PAGE@@"
      type=list
      sql=|
             SELECT  password
             FROM    mb_boxlist
             WHERE   username = '[data session username]'
             AND     boxname = '[cgi c_box]'
           |]
      [list]
       c_pass=[sql-param password]
      [/list]
    [/query]

  mv_nextpage=c_invite

[/if]
[/button]

...but as Dan pointed out, it is possible that you are trying to do too 
much with this one form.

- Ed L.

===============================================================
Increase profits from your Interchange store...
http://www.newmediaems.com/cgi-bin/nm/software_fus.html
===============================================================
New Media E.M.S.               Software Solutions for Business
463 Main St., Suite D          eCommerce | Consulting | Hosting
Placerville, CA  95667         edl@newmediaems.com
(530) 622-9421                 http://www.newmediaems.com
(866) 519-4680 Toll-Free       (530) 622-9426 Fax
===============================================================