jignesh1 wrote:u could use javascript regualr expression so that way it wont use server resources
While it's true that Javascript wouldn't require the server to do anything, Javascript is a client-side language and should therefore never be used for validation methods. Period.
Using regular expresion, however, is the way to go for checking the syntax of an entered e-mail address. Now, there are numerous solutions out there. The problem lies in finding one that a) doesn't have too many (or any?) false positives, yet b) is sturdy enough to reject fake addresses. Search the board for "email regular expression" (or Google) and you'll be inundated. For a sample, here's a user-contributed note I found on the manual page for [man]preg_match/man (the function you should use to validate the address):
function is_email($Addr)
{
$p = '/^[a-z0-9!#$%&*+-=?^_`{|}~]+(\.[a-z0-9!#$%&*+-=?^_`{|}~]+)*';
$p.= '@([-a-z0-9]+\.)+([a-z]{2,3}';
$p.= '|info|arpa|aero|coop|name|museum)$/ix';
return preg_match($p, $Addr);
}
As for checking if a checkbox has been checked... well that's easy enough! If the box isn't checked, it shouldn't be submitted at all, so you can check if it has been set at all, like so:
if(!isset($_POST['checkbox_name_here'])) {
// checkbox wasn't checked...
} else {
// checkbox WAS checked!
}