> Works like a charm, thanks! Guess I was trying to make it to difficult. I
> must've done something wrong, though... I had to alter the code a bit to
> make it work. It seemed that grabbing all the params tossed the param
values
> and I had to go back and get 'em once I had the key isolated.
> 
> Naming the fields as you suggested:
> 
> <textarea name="question_41" rows="6" cols="60">How's this gonna
> work?</textarea><br>
> <textarea name="question_40" rows="6" cols="60">Still another sample
> question</textarea><br>
> <textarea name="question_44" rows="6" cols="60">Here's a "swell"
performance
> question!</textarea>
> 
> And scripting thusly:
> 
> my $req = new CGI; 
>    my @URL_VARS = $req->param;
> 
>    foreach my $VARNAME (@URL_VARS) { 
>       if($VARNAME =~ /^question_(\d+)$/) {
>          my $st = "UPDATE tablename SET answer = '" .
$req->param($VARNAME)
> . "' WHERE id = '$1'";
>          print $st . "<br>\n";
>       }         
>    }
> 
> Gave me:
> 
> UPDATE tablename SET answer = 'How's this gonna work?' WHERE id = '41'
> UPDATE tablename SET answer = 'Still another sample question' WHERE id =
> '40'
> UPDATE tablename SET answer = 'Here's a "swell" performance question!'
WHERE
> id = '44'
> 

That's what I get for having templates and trying to go by memory.
'params' gives you (like you found) the list of all parameters, and your
adjustments are correct for that case, to work it the way I usually do
(and as it is in my own templates) you would do something like:

my %params = $request->Vars;

while (my ($key, $val) = each (%params)) {
   # yada, yada, yada...
}

Sorry about that...

http://danconia.org


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to