I already made a copy of your old files and made the changes I gave you :) Hopefully i had the latest changes, but the script is running on my local server with no errors after making a few changes:
I forgot that with that version of the list categories mod you also need to add the the following sub within your db.cgi file:
sub urlencode {
# --------------------------------------------------------
# Escapes a string to make it suitable for printing as a URL.
#
my($toencode) = shift;
$toencode =~ s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/eg;
$toencode=~s/\%2F/\//g;
return $toencode;
}
If you want to have the select field displayed in 2 columns use this version:
|;
for ($i = 0; $i <= $#db_cols; $i++) {
if ($db_cols[$i] eq "Land" ) {
$fieldnum = $i; $found = 1;
last;
}
}
if ($found) {
open (DB, "<$db_file_name") or &cgierr("unable to open $db_file_name. Reason: $!");
if ($db_use_flock) { flock(DB, 1); }
LINE: while (<DB> ) {
next if /^#/;
next if /^\s*$/;
$line = $_;
chomp ($line);
@fields = &split_decode ($line);
# if ($fields[2] eq "Yes") { ### validation field
## ------- changed for use with multiple select categories -----
@values = split (/\Q$db_delim\E/o, $fields[$fieldnum]);
foreach $value (@values) {
if (!(grep $_ eq $value, @selectfields)) {
push (@selectfields, $value);
}
++$count{$value};
}
## -------------
}
# } # end validation check
close DB;
@options = split (/\,/, $db_select_fields{'Land'});
my $half = int (($#options+2) / 2);
my $i = 0;
print qq|<CENTER><TABLE width="460" border=0 cellspacing="0" cellpadding="10"><TR><TD valign="top" width="225"><$font> |;
foreach $option (sort @options) {
unless ($count{$option}) {
$count{$option} = '0';
}
$encoded = &urlencode($option);
if ($i == $half) {
print qq|</font></TD><TD valign="top" width="225"><$font>|;
}
$i++;
print qq|<A HREF="$db_script_link_url&sb=$sort_field&so=$sortorder&Validated=Yes&Land=$encoded&view_records=1">$option</A> ($count{$option})<BR>|;
}
}
print qq| </font></TD></TR></TABLE></CENTER>|;
==========
In sub html_record and html_record_long, just after
my (%rec) = @_;
add this line:
$rec{'Land'} =~ s/\|/, /g; ## display multiple selects with space and comma
This will cause all of the | characters to be replaced by a "comma-space" before they are printed out.
=============
In your short display why not use:
print qq|
<A HREF="$long_url">$rec{'Nick'}</A></TD><TD>$rec{'Fylke'}</TD><TD>$rec{'Land'}</TD><TD>$rec{'EndretDato'}
|;
In html_view_success you can state the table width to have it space the columns nicely.
print "<table width=450>";
Unoffical DBMan FAQ
http://creativecomputingweb.com/dbman/index.shtml/