Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Trouble passing parameters into HTML

by Nihil Angst (Novice)
on Aug 16, 2002 at 00:12 UTC ( #190556=perlquestion: print w/replies, xml ) Need Help??

Nihil Angst has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to use variables to insert values from
forms into HTML. When my page prints, instead of
the variables printing out the desired values, they
print nothing, not even a blank space. I'm using
the module, but I could switch to if someone gave me the code for getting
parameters with it. (Tripod only provides
information on how to use their proprietary
modules, and I'm a newbie.) Here's the code I'm
using, prepared according to Tripod's instructions.
Thanks in advance for your help.
require TripodCGI; $CGI = TripodCGI; $firstName=$CGI->param('firstName'); $lastName=$CGI->param('lastName'); $Age=$CGI->param('Age'); print "Content-type: text/html\n\n"; print <<ENDHTML; <HTML> <HEAD> <TITLE>CGI Test</TITLE> </HEAD> <BODY> <H2>Welcome!</H2> <P>We're glad to see you $firtName, members of the $lastName family are always welcome here. It's hard to believe that you're already $Age years old. My how time flies.</P> </BODY> </HTML> ENDHTML

Replies are listed 'Best First'.
Re: Trouble passing parameters into HTML
by fuzzyping (Chaplain) on Aug 16, 2002 at 02:33 UTC
    I don't mean to be a jerk, but rather than continue to post the same (or similar) questions regarding Tripod's proprietary CGI module, why don't you take some time to learn the excellent CGI module? There's a plethora of good newbie documentation out there (examples to follow). In addition, you're sure to find folks here with plenty of *real* CGI experience, who will be happy to help someone who knows how to help themselves.

    And be sure to check out the various introductions to HTML::Template, my favorite HTML templating module, found on the HTML-Template website or here on PerlMonks Tutorials. Of course, unless your provider already has this installed on their server (or you have shell access), you won't be lucky enough to enjoy it.

    Hope this helps... now go show us some effort! ;-)


    Update: Fixed link to HTML-Template website, thanks fireartist.
Re: Trouble passing parameters into HTML
by Maclir (Curate) on Aug 16, 2002 at 00:48 UTC
    Firstly, you have a typo with "firtName". To me, it looks like TripodCGI is just a wrapper around the standard module. If so, there are many ways you can get to the CGI request parms - the documentation for is fairly self explanatory.
(jeffa) Re: Trouble passing parameters into HTML
by jeffa (Bishop) on Aug 16, 2002 at 15:11 UTC
    First, switching from to is a breeze. Just replace this:
    require TripodCGI; $CGI = TripodCGI;
    with this:
    use CGI; $CGI = CGI->new();
    Now, you really should also be using as well, which (among other Good Things™) forces you to declare your variables. tye has given the Monastery an excellent writeup on - read it!

    A couple of the cool features of are it's function interface (importing it's subroutines right into your script so you just type param() instead of $CGI->param()) and it's methods for generating HTML, such as p(), h2(), and form elements. So, with that in mind - here is a rewrite of your script:

Re: Trouble passing parameters into HTML
by Cody Pendant (Prior) on Aug 16, 2002 at 01:41 UTC
    Apart from the typo mentioned below, it's possible that the error comes from your form code.

    What does the form look like which is submitting this info to the script?

    ($_='jjjuuusssttt annootthheer pppeeerrrlll haaaccckkeer')=~y/a-z//s;print;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://190556]
Approved by IlyaM
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2021-01-19 22:05 GMT
Find Nodes?
    Voting Booth?