Hi guys,
I am new to programming and perl. Am learning how to create feedback forms. I seem to get stuck at email validation. What am I doing wrong? Can someone please help me.
Thanks a lot. Here is how my script reads
#Validate input of correct email address
$good_email = 0;
@check_email = split (//, $email);
foreach $letter (@check_email)
{
if ($letter eq "@")
{
$good_email = 1;
last;
}
}
print("Content-Type: text/html\n\n");
print "<HTML>\n<HEAD>\n";
if (!$good_email)
{
print "<TITLE>Invalid email address</TITLE>\n\<BODY>\n";
print "<H2>Invalid Email Address detected</H2>";
print "<p>Please provide correct email address. Go back to the form</p>\n";
}
else
{
print "<TITLE>Thank You</TITLE>\n<BODY>\n";
print "<P>Thank you for filling out the form. We will contact you soon at $email</P>";
}
I am new to programming and perl. Am learning how to create feedback forms. I seem to get stuck at email validation. What am I doing wrong? Can someone please help me.
Thanks a lot. Here is how my script reads
#Validate input of correct email address
$good_email = 0;
@check_email = split (//, $email);
foreach $letter (@check_email)
{
if ($letter eq "@")
{
$good_email = 1;
last;
}
}
print("Content-Type: text/html\n\n");
print "<HTML>\n<HEAD>\n";
if (!$good_email)
{
print "<TITLE>Invalid email address</TITLE>\n\<BODY>\n";
print "<H2>Invalid Email Address detected</H2>";
print "<p>Please provide correct email address. Go back to the form</p>\n";
}
else
{
print "<TITLE>Thank You</TITLE>\n<BODY>\n";
print "<P>Thank you for filling out the form. We will contact you soon at $email</P>";
}