Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I am running into a problem with gathering data from a website. When you first go to the website your only option is to enter an MAC address (ex. 1122.3344.5566) into a form. When you submit it the page returns with the same form as before but several other pieces of data formatted into several other forms as well.(uses same URL both before and after first form is submitted)

I can fill in the first form and submit it with no issue what so ever. The problem become when I get my results and then need to submit a form from what would be the second page. I can not figure out how to enter data on the second page which happens to be in the second form on page 2.

I can not share the actual code, but have placed generic information in place of such things as the actual URL.

use WWW::Mechanize; my $mech = WWW:Mechanize->new(); my $url = "" $mech->get(url); $result = $mech->submit_form( form_number => 1, fields => { modem => '1122.3344.5566' } ,button => 'submit' ); #### up to this point everything works perfectly. #### $result->content gives me all of the data I would #### normally see $results2 = $mech->submit_form( form_number => 2, fields => { modem => '1122.3344.5566' ip_select => '' } ); #### the submit button does not have a name on this form #### and if I read the docs correct the form will still #### submit using submit()

The error I get is: There is no form number 2. I am still pretty new to PERL and as such am stuck on how to fill in the second form and get it submitted. Any wisdom would be great. Thank you in advice.

In reply to Submitting a second form by rp132

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others scrutinizing the Monastery: (6)
    As of 2018-01-22 22:51 GMT
    Find Nodes?
      Voting Booth?
      How did you see in the new year?

      Results (238 votes). Check out past polls.