Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

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 = "http://www.example.com/cgi-bin/testcode.tcl" $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 => '1.2.3.4' } ); #### 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

Title:
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!
  • 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
  • Outside of code tags, you may need to use entities for some characters:
            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?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others having an uproarious good time at the Monastery: (11)
    As of 2014-12-19 14:20 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (84 votes), past polls