I do not understand why you want to put it out to a tmp file. You can create a dispatch table at the top of your CGI script. This script could produce the form and take the results and make the change to the DB. If you have security issues with the DB that you are concerned about I can help you set it up correctly if you have some more details. Also you have your website protected by htaccess and you did not supply a user name and password
Other than that, a couple of things I noticed in your script -
You use a lot of font tags - you should factor all that style info to a CSS. Here is a good link about
You are not using all the nice features of CGI.pm like building your table for you
Personally I avoid HTML tags in code it's easier to read code.