|
Posted by smallpond on March 27, 2008, 11:55 am
Please log in for more thread options >
>
> > In general, you just don't do that. If you want to put processing code
> > in separate files, just use those files from the same CGI program. IOW,
> > use modules. That's more efficient and less error prone than trying
> > to invoke stand-alone scripts from each other (not to mention that doing
> > that will probably not work out of the box for CGI scripts that read
> > POST data).
>
> > HTH,
> > Joost.
>
> But in the sense of putting the search and fetch functions in the same cgi,
> how come results can be generated after accepting users' input parameters? A
> simple example based on my simplified codes will be appreciated~
>
> #!/usr/bin/perl
>
> use CGI qw(:standard);
>
> $query = new CGI;
>
> print $query->header;
>
> print $query->startform;
> print "Title: ",$query->textfield(-name=>'title', -justification=>'RIGHT');
>
> print $query->submit(-name=>'button_name', -value=>'Get !');
> print $query->endform;
> print $query->end_html;
>
> #the following print can be executed successfully but the resultant page is
> just wield....
> print $query->param('title');
> print "<BR>";
The process that prints out a web page form is not the same process
that gets the result of filling it out and pressing the submit
button. They don't have to have any connection and don't have to
be on the same web server. I can create a search form on my website
and submit it to google, for example.
It is sometimes convenient to do them both from one cgi and sort
out which call is being made from the params, but if you are just
getting started try making the form with a static web page and
handling only the submit in the cgi. Work up from there.
--S
|