[ic] Native joiner for multi-selection form variables

Bill Randle billr@exgate.tek.com
Fri, 22 Sep 2000 14:44:00 -0700


Chris,

The multiple check box selections are seperated with a NUL byte.
You can split and join them in Perl with something like this:

	my @checkboxes = split /\0/, $Values->{checkboxname};
	$Values->{checkboxname} = join '\0', @checkboxes;

or, to store the value(s) in your db you can do this:
	my $checkboxfield = $Values->{checkboxname};
	$checkboxfield =~ s/\0+/ /g;
if you're sure none of the box values has a space in it, or, my
preference:
	$checkboxfield =~ s/\0+/|/g;

Then to put it back on the page after reading from the db, either:
	($Values->{checkboxname} = $checkboxfield) =~ s/\|/\0/g;
or
	($Values->{checkboxname} = $checkboxfield) =~ s/ /\0/g;
depending on which seperator you used.

	-Bill