Here's where the problem you were referring to is located. The values for those two hidden fields are hard coded, which is why the results never change. You need to use the updated vars that you assigned above.

$q->param(-name=>"first_var", -value => $v1); $q->param(-name=>"second_var", -value => $v2); } What do you expect these lines to do? I can assure you that they don't do what you expect and are not needed/wanted. Remove them.

thought these 2 lines are updating the values for "first_var", "second_var". this is what param( ) for.

$q->param(-name=>"first_var", -value => $v1); $q->param(-name=>"second_var", -value => $v2); } What do you expect these lines to do? I can assure you that they don't do what you expect and are not needed/wanted. Remove them.

thought these 2 lines are updating the values for "first_var", "second_var". this is what param( ) for.

is it because these 2 lines are not inside the form block ?

Sounds like you need to read the CGI documentation more carefully.

The param() method is used (almost exclusively) to RETRIEVE the SUBMITTED form field data. It is also overloaded so that you can add/update/set a parameter that is used during this execution of the script but is never used to update a form field that the user sees and sends back for the next invocation of the script.

In your case, you're updating the values of those params, but never use them after that, which makes it pointless.

The hidden form fields are doing what you think those 2 param() statements are doing.

$q->param(-name=>"first_var", -value => $v1); $q->param(-name=>"second_var", -value => $v2); } What do you expect these lines to do? I can assure you that they don't do what you expect and are not needed/wanted. Remove them.

thought these 2 lines are updating the values for "first_var", "second_var". this is what param( ) for.

is it because these 2 lines are not inside the form block ?

Sounds like you need to read the CGI documentation more carefully.

The param() method is used (almost exclusively) to RETRIEVE the SUBMITTED form field data. It is also overloaded so that you can add/update/set a parameter that is used during this execution of the script but is never used to update a form field that the user sees and sends back for the next invocation of the script.

In your case, you're updating the values of those params, but never use them after that, which makes it pointless.

The hidden form fields are doing what you think those 2 param() statements are doing.