This is because on main page, will not pass category ID number to add.cgi.
Try this code:
my $catid_current = shift;
my $catid_check = shift;
return 0 if $catid_current =~ /^\d$/;
return 0 if $catid_check =~ /^\d$/;
return 1 if $catid_check eq $catid_current;
my @children = $DB->table('Category')->children($catid_check);
foreach (@children) {
return 1 if $_ eq $catid_current;
}
}EDIT: further checking added, to allow only numbers, as ID.
This will ignore the situation, when you are clicking add.cgi in home.html or no ID is passed.
Also I changed to avoid second input parameter to be 0, since it's the root category.
Hope that helps.
Best regards,
Webmaster33
Paid Support from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Try this code:
Code:
sub { my $catid_current = shift;
my $catid_check = shift;
return 0 if $catid_current =~ /^\d$/;
return 0 if $catid_check =~ /^\d$/;
return 1 if $catid_check eq $catid_current;
my @children = $DB->table('Category')->children($catid_check);
foreach (@children) {
return 1 if $_ eq $catid_current;
}
}
This will ignore the situation, when you are clicking add.cgi in home.html or no ID is passed.
Also I changed to avoid second input parameter to be 0, since it's the root category.
Hope that helps.
Best regards,
Webmaster33
Paid Support from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...