in reply to Re: getting parameters
in thread getting parameters

its like this i get the parameters from html file to hello.pl very well, no problem with these both files bt the problems comes when i want to pass the parameters(strings) i got in hello.pl to welcome.pl, thats why i did $x = $cgi->param('$fname') because we used $fname to show paramter from html in hello.pl, and now am trying to print $x to show the parameter or string value $fname from hello.pl take time look at the script flow, then u will understand wat am taking about, or try to run it at ur side

Replies are listed 'Best First'.
Re^3: getting parameters
by poj (Abbot) on Nov 29, 2014 at 20:54 UTC

    You need to add inputs and a submit button in hello.pl

    # hello.pl use CGI; use strict; my $cgi = CGI->new(); my $fname = $cgi->param('firstname'); my $lname = $cgi->param('lastname'); print "Content-Type: text/html\n\n"; print $cgi->start_html; print <<HTML; <h3>Hello</h3> <table cellpadding="5"> <tr> <td>Firstname</td> <td><b>$fname</b></td> </tr> <tr> <td>Lastname</td> <td><b>$lname</b></td> </tr> </table> <form method="post" action="welcome.pl"> <input type="hidden" name="firstname" value="$fname"/> <input type="hidden" name="lastname" value="$lname"/> <input type="submit"/> </form> </body> </html> HTML

    and amend welcome.pl

    #!perl # welcome.pl use CGI; use strict; my $cgi = CGI->new(); my $x = $cgi->param('firstname'); my $q = $cgi->param('lastname'); print "Content-Type: text/html\n\n"; print $cgi->start_html; print <<HTML; <h3>Welcome</h3> <table cellpadding="5"> <tr> <td>Firstname</td> <td><b>$x</b></td> </tr> <tr> <td>Lastname</td> <td><b>$q</b></td> </tr> </table> </body> </html> HTML
    poj
      thanks poj it worked