in reply to Re^5: [Solved]: Can we use print <<HTML; twice in same file?
in thread [Solved]: Can we use print <<HTML; twice in same file?
So when fetched in sorted order $widget[0] will hold the active flag for average_speed_answer not trunk_usage?. Or have you changed the script to use different elements. For example where you had
if (row[0] eq '1') { print "<td><form><input type="checkbox" name="trunk_usage" value="1" + checked>% Trunk Usage</form></td>";
is that now
update :if ($widget[4] eq '1') { print "<td><form><input type="checkbox" name="trunk_usage" value="1" + checked>% Trunk Usage</form></td>";
If you used a hash instead of an array
my $sql = 'SELECT name,active FROM comm_desk_widget_status WHERE user = ?'; my $sth = $dbh->prepare($sql); $sth->execute('admin'); my %widget=(); while (my ($name,$active) = $sth->fetchrow_array) { $widget{$name} = $active; }
then you could use
if ($widget{'percent_trunk_usage'} == 1) { print "<td><form><input type="checkbox" name="trunk_usage" value="1" + checked>% Trunk Usage</form></td>";
and there would be no chance of getting out of step
poj
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: [Solved]: Can we use print <<HTML; twice in same file?
by Perl300 (Friar) on Aug 25, 2015 at 21:11 UTC | |
|
Re^7: [Solved]: Can we use print <<HTML; twice in same file?
by Perl300 (Friar) on Aug 25, 2015 at 20:44 UTC | |
by 1nickt (Canon) on Aug 25, 2015 at 22:12 UTC |