Re: Passing value to another CGI.

From: sam (sam.wun_at_authtec.com)
Date: 12/30/04


Date: Thu, 30 Dec 2004 13:24:45 +0800

John Bokma wrote:
> sam wrote:
>
>
>>ioneabu@yahoo.com wrote:
>>
>
>>>
>>>http://stein.cshl.org/WWW/software/CGI/#advanced
>>>
>>>#!/usr/bin/perl
>>>
>>>use CGI q(:standard);
>>>use warnings;
>>>use strict;
>>>
>>>print header();
>>>print start_html();
>>>print start_form(-action=>'form1.cgi');
>>>print textfield({name=>'Name', value=>"bob"});
>>>print br();
>>>print end_html();
>>>
>>>
>>
>>Do you know how to pass the variable name "Name" and its value "bob"
>>to form1.cgi?
>
>
> That already happens (unless someone changes the value ;-) ).
>
> Also, note that the print part above can be simplified as follows:
>
> print header(),
> start_html(),
> :
> end_html();
>
> (ie, just one print). And I guess you can drop the () too :-D.
>

OK, this is perfectly fine.
But whatif I put another paire of "embedded" start_form and end_form
within one start_form and end_form, something like the following coding:

print $query->start_form(-action=>'Main.cgi');
print $query->textfield({name=>'Name', value=>"bob"});
print $query->br();

print $query->start_form(-action=>'form5.cgi');
print $query->submit(-name=>'goto form5.cgi');
print $query->end_form();

print $query->submit(-name=>'goto Main.cgi');
print $query->end_form();

When press the form5 button, it will certainly go to Main.cgi instead of
form5.cgi.
Is there a way fix this error?
I was thinking use javascript to construct the part of "action
form5.cgi" and its submit button (form5). What do you think this idea?

I have a looked at LWP before, but there is no instruction/example about
how to deal with this situiation.

Thanks
Sam