jagb has asked for the wisdom of the Perl Monks concerning the following question:

I would like to go to a web page and process/enter data into a form. With single form pages, PERL & LWP's do_POST works just dandy (for me). The page I am looking at does not use frames and embeds 3 seperate <forms> on the same page. For a human, entering data in the textfield and clicking is easy. Any ideas on how to get there with LWP. I've looked and looked and read and read but to no avail. Any suggestions would be greatly appreciated. Thanks ...A Monk in training

Replies are listed 'Best First'.
Re: LWP multi-form POST
by jonadab (Parson) on Feb 10, 2004 at 20:30 UTC

    First, when a human enters data in a regular web browser and then clicks Submit, only one form will be submitted, the form that the Submit button comes from.

    Second, have you looked at WWW::Mechanize?


    $;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}} split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print$/
      A lot of sites use javascript to submit multiple forms. This allows all sorts of things, including creating hoops that make it harder to use a language like perl to spider a site.

      Want to support the EFF and FSF by buying cool stuff? Click here.
        A lot of sites use javascript to submit multiple forms

        Can you site an example of a site that does this? (I'm not denying it -- I've seen all sorts of weird things done with scripts that ought not to be possible. I'm just curious how it's accomplished, given that normally the submission of a form causes the browser to stop executing the scripts on that page as it goes on to fetch the new form-result page.)

        This allows all sorts of things, including creating hoops that make it harder to use a language like perl to spider a site.

        I suspect it's possible to get around this using WWW::Mechanize and maybe Clone::PP, but I'd have to see the details of what the scripts on the site are doing.


        $;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}} split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print$/
Re: LWP multi-form POST
by Vautrin (Hermit) on Feb 10, 2004 at 21:01 UTC
    Check out HTML::Form from CPAN. All you really need to do is create 3 seperate submissions for each form. One form will be the form that the user sees the response from. Examine the javascript, use a Javascript Debugger like Mozilla's Venkman, and watch the Headers -- check out LiveHTTPHeaders for Mozilla.

    Want to support the EFF and FSF by buying cool stuff? Click here.