I am trying to find a way to get values back from a dynamic list of checkboxes.

Within my template I have figured out how to create the list of checkboxes based on values from a hash reference. Like so:

    <% FOREACH ID IN Accomps.keys %>
            <div> 
              <label><input type="checkbox" name="<% Accomps.$ID.NAME %>" value="<% Accomps.$ID.ID %>"><% Accomps.$ID.NAME %> <% Accomps.$ID.descrip %></label>
            </div> 
            <% END %>
            </div>

However, I can't figure out how dancer would go about getting back the values from the list of checkboxes as each checkbox input's name is different. I normally get values back in Dancer with:

like this:

 my $input_hash = { 
      
       Tech => param('tech), 
       Type => param('type'),
        
}

But I cannot figure out how to do it in this case since the name of the input type is based on the values in the has ref. I have tried to create them based on the values that are fed into the template from the SQL query like this:

my $input_hash = { 
      
       Tech => param('tech), 
       Type => param('type'),
        
      while ($sth->fetch) {
     
       $ANAME => param($ANAME),

      }

      }

But this causes plackup start to crash with:

Error while loading /home/richard/Dancer2/MyApp/bin/app.psgi: syntax error at /home/richard/Dancer2/MyApp/bin/../lib/MyApp.pm line 549, near "while"
syntax error at /home/richard/Dancer2/MyApp/bin/../lib/MyApp.pm line 555, near "}"

So I am beginning to think that I am heading down the wrong path.  Any help would be greatly appreciated.

Thanks