WintersMystic
Programmer
hi, 
ok, this script is a contact form email script. i havent put in the email routine, cause that i know how to do. well, this one wont work at all. what im wanting it to do so far is show each of the error msgs if that field is left blank. ive never used a die call, so i dont know if thats the reason its failing or not. ive been writing in perl for a few months now. anyone help?
ok, this script is a contact form email script. i havent put in the email routine, cause that i know how to do. well, this one wont work at all. what im wanting it to do so far is show each of the error msgs if that field is left blank. ive never used a die call, so i dont know if thats the reason its failing or not. ive been writing in perl for a few months now. anyone help?
Code:
usr/bin/perl
use CGI::Carp qw(fatalsToBrowser);
BEGIN {
use CGI::Carp qw(carpout);
open(LOG, ">mycgi-log") or
dienice("Unable to open mycgi-log: $!\n");
carpout(LOG);
};
#contact us form#
#variables#
use CGI ':standard';
if(param()){
$Name=param('name') or dienice("Please enter a name");
$Ref=param('ref') or dienice("Please specify a referer");
$Type=param('type_comment') or dienice("Please specify a comment type");
$Msg=param('msg') or dienice("Please enter some comments");
$Email=param('email') or dienice("Please enter a valid email address");
} else {
print "<html><head><title>Result</title>";
print "<body>";
print "$Name<p>";
print "$Email<p>";
print "$Ref<p>";
print "$Type<p>";
print "$Msg<p>";
print "</body></html>";
}
$ZS="wave\@zip-script.com,mysticpoet\@zip-script.com";
#end variables#
sub dienice{
my ($msg) = @_;
print "<html>";
print "<body>";
print "<h2>Error</h2>\n";
print "$msg";
print "</body>";
print "</html>";
exit;
}