if (row[0] eq '1') {
print "<td><form><input type="checkbox" name="trunk_usage" value="1"
+ checked>% Trunk Usage</form></td>";
is that now
if ($widget[4] eq '1') {
print "<td><form><input type="checkbox" name="trunk_usage" value="1"
+ checked>% Trunk Usage</form></td>";
update :
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 |