intranetman has asked for the wisdom of the Perl Monks concerning the following question:

My code from below is suppose to take user input and submit it to a database. Everything works fine except of course for the data being stored in their respective variables. Whenever I attempt to do this I have a custom error_message returned for each field. I know its not the $error_message problem or how I submit the data yet I was thinking it was one of the three snippets below:
&print_page_start; if($query->param('submitted')) { $error_message = ""; &validate_form; if($error_message eq "") { &submit_form_values; } else { print "<form><tr><td colspan=2 bgcolor=#FFFFFF><font face=Arial +size=2 color=#FF0000> <br><b>\n" . $error_message . "</b></td></tr></form>\n"; } } else { &set_initial_values; &print_form; } &print_page_end;
or
sub set_initial_values { $firstname = $query->param('firstname'); $lastname = $query->param('lastname'); $email = $query->param('email'); $phone = $query->param('phone'); $dob = $query->param('dob'); $workstation = $query->param('workstation'); $username = $query->param('username'); $password = $query->param('password'); $passagain = $query->param('passagain'); }
or
# the important part of submit form sub print_form { print "<form action=register.cgi method=post>\n"; print "<input type=\"hidden\" name=\"submitted\" value=\"yes\" />\ +n"; print "<tr><td colspan=2 bgcolor=#FFFFFF><font face=Arial size=2 c +olor=#000000> <br>First Name</font></td><td bgcolor=#FFFFFF><input type=\"text\" + name=\"$firstname\" size=25 maxlength=20 /> </td></tr> \n"; }