ypcat has asked for the wisdom of the Perl Monks concerning the following question:
I have tested the data in @network_data & @location_data and the data was there. Also when I append @location_data to @network_data the data makes it through to the webpage as well. To help visualize these LOOP's populate HTML drop downs. Here is the relavent parts of my main.tmpl file.#!/usr/bin/perl -w use strict; use HTML::Template; use DBI; ##DB CALL## my (@network_data, @location_data) = get_data(); ##Template## my $template = HTML::Template->new(filename => 'main.tmpl'); $template->param( NETWORK_DATA => \@network_data); $template->param( LOCATION_DATA => \@location_data); print "Content-Type: text/html\n\n", $template->output;
These loops are not within each other and I dont care whether or not they can access each other's data. I am simply trying to have essentially 2 while loops with 2 data sets that loop through and print out and for some reason LOC_VALUE is triggering an error. I've switch around so many things I can't remember any more helpful information to tell at this time.IP: <select name="network" id="network"> <option value="None" selected>None</option> <TMPL_LOOP NAME="NETWORK_DATA"> <option value="<TMPL_VAR NAME=NET_ID>"><TMPL_VAR NAME=NET_ +VALUE></option> <br> </TMPL_LOOP> </select> <select name="location" id="location"> <option value="None" selected>None</option> <TMPL_LOOP NAME="LOCATION_DATA"> <option value="<TMPL_VAR NAME=LOC_ID>"><TMPL_VAR NAME=LOC_ +VALUE></option> <br> </TMPL_LOOP>
while (my $ref = $sth->fetchrow_hashref()) { my %row_data; $row_data{NET_ID} = $ref->{'id'}; $row_data{NET_VALUE} = $ref->{'value'}; push(@network_data, \%row_data); } while (my $ref2 = $sth2->fetchrow_hashref()) { my %row2_data; $row2_data{LOC_ID} = $ref2->{'id'}; $row2_data{LOC_VALUE} = $ref2->{'value'}; push(@location_data, \%row2_data); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: HTML::Template Error
by tinita (Parson) on Jul 24, 2004 at 13:01 UTC | |
|
Re: HTML::Template Error
by dws (Chancellor) on Jul 24, 2004 at 16:05 UTC | |
by ypcat (Beadle) on Jul 24, 2004 at 19:57 UTC |