I'm new to Perl and having a problem with populating a textarea with the results of a query using tmpl_var.

The tmpl form:

<html> <form> <p><label for="id" >Record ID</label> <input id="id" value="<TMPL_VAR +name=id>" style="width:363px" ></p> <p><label for="dateOfIncident" >Date of Incident</label> <input id="da +teOfIncident" value="<TMPL_VAR name=dateOfIncident>" style="width:363 +px" ></p> <p><div><label for="descOfSymptoms">Description of Symptoms</label> <t +extarea id="descOfSymptoms" style="width:363px" rows="4" <TMPL_VAR de +scOfSymptoms> ></textarea></p> </form> </html>

The cgi script:

#!/usr/local/bin/perl use warnings; use strict; use CGI; use DBI; use HTML::Template; my $query = new CGI; my $id = $query->param('id'); my $db=DBI->connect( "dbi:Oracle:instance","user","password" ) || die( + $DBI::errstr . "\n"); my $SQL = "SELECT id, dateOfIncident, descOfSymptoms FROM KnownErrors +WHERE id='$id'"; my $sth=$db->prepare($SQL); $sth->execute(); my $template = HTML::Template->new(filename => '/usr/local/apache2/htd +ocs/test.tmpl'); while (my $results = $sth->fetchrow_arrayref) { $template->param(id => $results->[0]); $template->param(dateOfIncident => $results->[1]); $template->param(descOfSymptoms => $results->[2]); } print "Content-Type: text/html\n\n", $template->output;

The id and dateOfIncident populate with no problem. But I can't get the textarea to populate. If I change the textarea to a text box it populates just fine. For the textarea I've tried value="<TMPL_VAR descOfSymptoms>", name="<TMPL_VAR descOfSymptoms>", and no label: <TMPL_VAR descOfSymptoms>. All return nothing to textarea.

I'm working on Solaris 10 x86 in Vmware. Apache version is 2.3. Database is Oracle 10.2.0.2.


In reply to HTML::Template and Textarea by kiloway54

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.