Here's one way of doing it. I can't help but think that Template would make this so much easier. In your case, you may just want to use HTML::FillInForm. Check it out :)
use strict; use CGI::Simple qw(-debug2); use HTML::Template; my $q = CGI::Simple->new(); my $t = HTML::Template->new( filehandle => \*DATA ); my $type = $q->param('type') || 1; $t->param( type_values => [ map { { value => $_, checked => ($_ eq $type ? 'CHECKED' : '') } } 1..12 ] ); print $q->header(), $t->output(); __DATA__ <TMPL_LOOP NAME="type_values"> <input type="radio" name="type" value="<TMPL_VAR NAME="value">" <TMPL_VAR NAME="checked"> /> </TMPL_LOOP>
In reply to Re^3: Variable from a variable: the dark side?
by Anonymous Monk
in thread Variable from a variable: the dark side?
by bradcathey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |