I have a basic PHP mail processor and I'm looking to add 'inline' error checking. First off, here's the basic code I'm using:
FORM.PHP:
<form method="post" action="mail.php">
Your Email:<br />
<input name="email" type="text" /><br />
Subject:<br />
<input name="subject" type="text" /><br />
Recipient:<br />
<select name="recipient" />
<option selected>Recipient</option>
<option value="guy1@site.com">Guy #1</option>
<option value="guy2@site.com">Guy #2</option>
</select>
Message:<br />
<textarea name="message" rows="15" cols="40">
</textarea><br />
<input type="submit" />
</form>
MAIL.PHP:
<?
$email = $_REQUEST['email'] ;
$recipient = $_REQUEST['recipient'] ;
$subject = $_REQUEST['subject'] ;
$message = $_REQUEST['message'] ;
mail( "$recipient", "$subject",
$message, "From: $email" );
header( "Location: [url]http://www.blah.com/thankyou.html[/url]" );
?>
What I'd like to do is add error checking that will display an error for any null required fields beside the field in question (ie:
Your Email:
[email field here] *An Email Address Is Required
Also, I'm not sure if $recipient will work as I've obviously intended here. Anyway, I hope you guys n' gals know what I mean by all this and have some advice!
Thanks in advance,