Home : Products : DBMan : Customization :

Products: DBMan: Customization: Re: [RedRum] Passing values in the URL: Edit Log

Here is the list of edits for this post
Re: [RedRum] Passing values in the URL
Didnt work. I rolled back to my previous solution:

In the form:

<input type=checkbox name=my value="$id,">sdafsdfsdf

Splitting up:

@fields = split(/\,/, $data{'my'});

Checking against db file:

for ($count=0;$fields[$count]>0 ;++$count) {
if ($fields[$count] eq $id) {
push (@result_list, $line)
}
}





This results in the passed values being split correctly into $fields[x] - but only the first $field[0] to be recognised in the [for] loop. Even thought I can see the other matches being correct...

I think this must be a prob with the handling code, ie:

sub get_data {
#######################################################################################
local($string);
# get data
if ($ENV{'REQUEST_METHOD'} eq 'GET') {
$string = $ENV{'QUERY_STRING'};
}
else { read(STDIN, $string, $ENV{'CONTENT_LENGTH'}); }
# split data into name=value pairs
@data = split(/&/, $string);
# split into name=value pairs in associative array
foreach (@data) {
split(/=/, $_);
$_[0] =~ s/\+/ /g; # plus to space
$_[0] =~ s/%0D%0A%0D%0A/\n\n/g; #added by kristina make newlines?
$_[0] =~ s/%0a/newline/g;
$_[0] =~ s/\%00//g;
$_[0] =~ s/%(..)/pack("c", hex($1))/ge; # hex to alphanumeric
if(defined($data{$_[0]})){
$data{$_[0]} .= "\0";
$data{$_[0]} .= "$_[1]";
}
else {
$data{"$_[0]"} = $_[1];
}
}
# translate special characters
foreach (keys %data) {
$data{"$_"} =~ s/\+/ /g; # plus to space
$data{"$_"} =~ s/%(..)/pack("c", hex($1))/ge; # hex to alphanumeric
$data{"$_"} =~ s/\%00//g;
}
%data; # return associative array of name=value
#######################################################################################
}

Last edited by:

eric74: Feb 8, 2002, 5:25 AM

Edit Log: