Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

using CGI, DBI and HTML::Template (a mini tutorial with example code)

by gav^ (Curate)
on Feb 09, 2002 at 04:13 UTC ( #144315=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download

  1. or download this
    <form action="" method="post">
    <p>Your name: <input type="text" name="name" 
      value="<TMPL_VAR NAME=COLOR>"></p>
    <p><input type="submit"></p>
  2. or download this
    <p>Hello, <b><TMPL_VAR NAME=NAME></b>. A little
    birdy told me your favorite color is <b><TMPL_VAR NAME=COLOR></b>.
  3. or download this
    use CGI;
    use HTML::Template;
    my $t = HTML::Template->new(filename => "$template.tmpl", associate =>
    + $cgi);
    print $t->output;
  4. or download this
    use DBI;
    use CGI;
    print $cgi->header;
    print $t->output;
  5. or download this
    <table border="1">
  6. or download this
    $t->param(ROWS => $rows, TOTAL => $sum);
  7. or download this
    <table border="1">
    <p>The total is <TMPL_VAR NAME=TOTAL></p>
  8. or download this
    use DBI;
    use CGI;
    print $t->output;

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://144315]
Approved by root
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2022-05-25 19:10 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (90 votes). Check out past polls.