Hello friends, can someone explain to me how can I submit form with radio button ?

I know how to fill and submit form if the form contain just a textboxes, here is the code:


use strict;
use WWW::Mechanize;
use HTTP::Cookies;

my $outfile		= "out.htm";
my $url 		= "";
my $username 	= "";
my $password 	= "";
my $useragent	= "Mozilla/9.876 (X11; U; Linux 2.2.12-20 i686, en; rv:2.0) Gecko/25250101 Netscape/5.432b1 (C-MindSpring)";

my $mech = WWW::Mechanize->new( agent => $useragent);

#$mech->field(myusername => $username);
#$mech->field(mypassword => $password);

        form_number => 1,
        fields      => { login => $username, pass => $password },

my $output_page = $mech->content();
open(OUTFILE, ">$outfile");
print OUTFILE "$output_page";

But I don't know how to select one of several radio buttons...

If someone wants to help me I would be grateful.


Re: Perl submit form with radio button 80 80

The problem is solved, here is the sollution:


# work = radio button name
# 1 = value of the radio button who want to select
        form_number => 1,
        fields      => { work => 1 },

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.