You may want to check out
Ovids CGI course.
To adress your problem: you have to parse the data from the incoming form and pass/use that to/in your template mechanism, so you can iterate over it. You don't mention what templating engine you use, so I can't be more specific here.