Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Reading form data and printing variables using CGI.pm

by gryphon (Abbot)
on Jul 19, 2002 at 21:13 UTC ( [id://183459]=note: print w/replies, xml ) Need Help??


in reply to Reading form data and printing variables using CGI.pm

Greetings cal,

You're on the right track. You just need to define what $Firstname is going to be.

my $Firstname = param('Firstname');

Put that somewhere in front of your print statement and you're done.

-gryphon
code('Perl') || die;

Replies are listed 'Best First'.
Re: Re: Reading form data and printing variables using CGI.pm
by cal (Beadle) on Jul 19, 2002 at 21:23 UTC
    But how does the variable become associated to the HTML line? 'is the value of $Firstname', Thanks
    <code> #!/usr/local/bin/perl -w use strict; use diagnostics; use CGI qw(:standard); my $Firstname = param('Firstname'); print header(), start_html(-title=>"CGI.pm Example Script"), h1('Hello World!'), 'is the value of $Firstname', end_html(); exit (0);

      Greetings cal,

      In Perl, using a single quote simply reads a string literally, but a double quote interprets a string. In your code, you have single quotes around the string where you use $Firstname. So what gets printed is literally "$Firstname". You actually want Perl to interpret the variable, so...

      print header(), start_html( -title => 'CGI.pm Example Script'), h1('Hello World!'), "is the value of $Firstname", end_html();

      -gryphon
      code('Perl') || die;

      Huh?
      my $PERL_FAQ = "butterscoth"; print 'my $PERL_FAQ \n'; print "my $PERL_FAQ \n";

      ____________________________________________________
      ** The Third rule of perl club is a statement of fact: pod is sexy.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://183459]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-19 22:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found