Hi, I have a page to input value and redirect to second page. In second form there are couple of buttons. I want a code call sub routines within second form. I don't want to call another form/page. Basically i am taking input of host name in first page and with the host name i am calling redirecting to second form. Because of telnet session, i want to continue in second page itself. i have created both the pages in cgi. Please someone help me. Thanks Srikanth ------------------------------- Here is my code below: test11.cgi ----------------------------------
#!"D:\Program Files\xampp\perl\bin\perl.exe" use CGI; use CGI::Carp qw(warningsToBrowser fatalsToBrowser); $co = new CGI; print $co->header, $co->start_html(-titile => 'Welcome'), $co->center ($co->h1('Welcome')), $co->start_form ( -method=>'POST', + -action=>"test12.cgi", ), "Enter host name/ip : ", $co->textfield ( -name=>'text1', + -value=>'', ), $co->submit('Submit'), $co->reset, $co->end_form(); $co->end_html; --------- second script test12.cgi --------- #!"D:\Program Files\xampp\perl\bin\perl.exe" use CGI; use CGI::Carp qw(warningsToBrowser fatalsToBrowser); use Net::Telnet; my @output1,@host,@output; my $telnet = new Net::Telnet ( Timeout=>90, Errmode=>'die',input_log=> +'input.log',output_log=>'output.log',Dump_Log=>'dump.log',Option_log= +>'option.log'); $co = CGI->new; print $co->header, $co->start_html(-titile => 'Welcome'), $co->center ($co->h1('Welcome....')); if($co->param()) { @host=$co->param('text1'); } @output1=$telnet->open(@host); if (@output1) { $telnet->waitfor('/login: $/i'); $telnet->print('xxxxx'); $telnet->waitfor('/Password: $/i'); $telnet->print('xxxxxxx'); $telnet->waitfor('/# $/i'); print "Connected to host : <b>@host</b>", $co->start_form ( -action=>"&ver1()"); print qq(<input type="submit" name="bsubmit" value="State" +>\n); print "<hr>", $co->end_form(); sub ver1() { print "test"; } } print $co->end_html;

In reply to Perl CGI multiple buttons by ckant8

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!
  • 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, details, 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, summary, 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.