i don't really get what the app is trying to do, however my observations are as follows. you're possibly printing many lines before finally rendering the form. it would be arguably better if the initial output was in a textarea or iframe with scrollbars, to make it easier to traverse the output (with option to copy that separately into an editor?) and the submit form. also the html could more closely reflect current best practises, i.e. follow xhtml standard, and use a stylesheet to set look/feel of the webpage instead of outdated html styling attributes. but these are not prerequisites as such, as your code will "work" as it is.
the hardest line to type correctly is: stty erase ^H