Or not.. >.< Wish I knew this stuff better. here's the code I am using:
PHP Code:
<?php
$usercode = $_POST['code'];
$codes = array('1', '2', '3', '4', '5');
$match = "false";
foreach ($codes as $value)
{
if(strcasecmp($realcode[$value], $usercode) == 0)
{
$match = "true";
}
}
if($match == "true")
{
$to = "info@n2flash.com";
$subject = "Raffle Code";
$email = "info@n2flash.com";
$message = $_REQUEST['code'] ;
$headers = "From: $email";
$sent = mail($to, $subject, $message, $headers) ;
if($sent)
{header( 'Location: http://www.n2flash.com/success.html' ) ; }
else
{header( 'Location: http://www.n2flash.com/error.html' ) ; }
}
else
{
header( 'Location: http://www.n2flash.com/error.html' ) ;
}
?>
If i submit a 1, 2 ,3, 4 or 5 or anything else... It directs to the error page, and no email is sent.
If I leave the form blank, it goes to success and sends an email. Is there somethign wrong with what I have?
Bookmarks