You are going in the right direction with the [idcode] or [role] part of the name, now all you have to do on the post back is to check if the $_key contains one of the 5 lines that you want to test for and add then in to the string in the approprate way.