1)
Your plan won't help you. TT concatenates all the output of a script to a single string before spitting it out. At least it does so until you tell it to do otherwise.
2)
Why do you use CGI::Prototype just to build a popup menu? Why not just use TT's loops and perhaps the DBI-Plugin?