my perl cgi page dropdown menu doesn;t listing the values . my cgi script
use HTML::Template;use CGI;
use CGI::Carp qw(fatalsToBrowser);
my $template = HTML::Template->new(filename => 'test.tmpl');
@count = ("abc,xyz,123,test");
print $cgi->start_form(
-name => 'mainpage',
-method => 'POST',
);
$template->param( COUNT => @count);
print $template->output();
my test.tmpl
<div class="row ">
<div class="col-lg-8 col-lg-offset-2">
<div class="dropdown">
<div class="input-field col s6">
<input name="count" id="countid" type="text" class="validate">
<label for="count">count</label>
<select>
<TMPL_LOOP NAME="COUNT">
<option value="<TMPL_VAR NAME=VALUE>"><TMPL_VAR NAME=NAME></option>
</TMPL_LOOP>
</select>
</div>
in the drop down menu, I am expecting below values. Please suggest if I need to make any change on above code on cgi or html template
abc
xyz
123
test
Please find the modified the cgi script values. cgi page doesn;t show the values in the dropdown tab. however in the html page rendered these values
$count = [
{ name => 'count1', value => 1 },
{ name => 'count2', value => 2 },
{ name => 'count3', value => 3 },
];
$template->param(COUNT => [{name => 'count1', value => 1}, {name => 'count2', value => 2}, {name => 'count3', value => 3}]);
print $template->output, "
";
html page rendered below
<div class="row ">
<div class="col-lg-8 col-lg-offset-2">
<div class="dropdown">
<div class="input-field col s6">
<input name="count" id="countstate" type="text" class="validate">
<label for="count">count</label>
<select>
<option value="1">count1</option>
<option value="2">count2</option>
<option value="3">count3</option>
</select>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…