Simple PHP Validation Help?
Hello, I have a very simple form where a user will enter a "code". I want to check that code to make sure it matches a list of codes. If it does the code will be emailed to me, and they would be redirected to a success page. If it doesn't match one of the valid codes, they would be redirected to an error page.
Here's my code so far:
PHP Code:
<?php
$to = "my email";
$subject = "Code";
$email = "my email";
$message = $_REQUEST['code'] ;
$headers = "From: $email";
$sent = mail($to, $subject, $message, $headers) ;
if($sent)
{header( 'Location: http://www.mysite.com/success.html' ) ; }
else
{header( 'Location: http://www.mysite.com/error.html' ) ; }
?>
As you can see no validation of the submitted code, I have no idea how to do this with php, but I know it's not hard.
All I really need is something simple where I can manually code 15 - 20 codes into the form and check for a match. Can anyone help?