in reply to RE: Re: checking if new CGI worked
in thread checking if new CGI worked

Actually you are trying to do all that and also check for possible errors. Everything should work except the error check. The error check is getting the return from push, which is the number of new elements in the array.

Which isn't testing what you are trying to do. OTOH what you are testing is something I don't think needs testing. The parameter has a value, else it wouldn't be tested.

(Minor note. If you have a list of elements, eg from a multiple-select, all of them are going on that list in one fell swoop.)

But your check for the name of the box having an "_" is wrong. You wind up there if any parameters do not match your pattern for a checkbox name. If this is truly an error then have your die message have the name of the parameter you are not accepting. Don't assume that this will be one of the first 4 parameters, or that you will remember later what the check is now.

So I would drop the first error message, and rewrite the second to actually mean what has been tested.

Oh, and in answer to your first question, try

$services{$product_id}[$i];
alternately you can get at the entire array as you did in your code. (This is just a hash of arrays.)

See perlref for more.