Maybe I simply don't understand what you want to achieve. It looks to me like you got several input fields on a web page, all with the same name, but with different id. Now you want to read the submitted form in your CGI and want to get the id, not the name.
AFAIK the id is not submitted, so no way to read it. You will have to make the name the id (or append the id to the name) in order to get that info.