You would use an array name for the form fields, with the room number as the array index. You would also dynamically produce that many repetitive same meaning form fields using a loop. The form fields should also be ‘sticky’ and repopulate the field values with any existing data, in case there is a validation error (or later when you are editing existing data.)
As to your main question, are you using a client-side library, such as jquery/bootstrap?