[ic] how to acces form fields..

Ed LaFrance interchange-users@interchange.redhat.com
Tue Sep 25 18:31:01 2001


At 04:38 PM 09/25/2001 -0500, you wrote:
>I found wath my problem really is, although I havent figured out
>how to solve it.
>
>I have a page called add_comments.html. In it I have a form
>with a mv_click called update_database.
>In the same page I have a [set update_database], which will handle
>the form. I also have:
>
>      <INPUT TYPE=hidden NAME="mv_todo" VALUE="return">
>       <INPUT TYPE=hidden NAME="mv_nextpage" VALUE="comment_stored">
>
>On the comment stored page I display the result of the form processing
>that its done by the [set update_database] block. For testing purposes
>I set a scratch var to the sql statement.
>
>If I try to add a comment, I end up in the "comment_stored" page, which
>is the desired result, BUT the sql contains nothing but empty records.
>This is how I build the sql query.
>
>my $sql = sprintf('INSERT INTO comments(sku,name) VALUES("%s","%s")',
>$Values->{cmnt_sku}, $Values->{cmnt_fullname});
>
>If I do a browser back button, change some values of the form and do a
>submit, the record gets inserted, with the values of the first form.
>Seems like the db insert gets done before the $Values get updated.
>
>How can I fix this ?

I think I understand what you want to do... maybe.  Try changing mv_click 
to mv_check - this will cause [set update_database][/set] to be processed 
*after* the session has been updated from the submit.  Also, you might want 
to use $CGI->{} instead of $Values->{}, just to be sure you are getting the 
data from the most recent form submission.  I think mv_check happens after 
$CGI data gets copied to $Values, but I am not 100% on that...

- Ed L.




===============================================================
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
===============================================================