emailphp

is_valid) { // What happens when the CAPTCHA was entered incorrectly die ("The reCAPTCHA wasn't entered correctly. Please use Back button and try it again." . "(reCAPTCHA said: " . $resp->error . ")"); } else { // Your code here to handle a successful verification $subject = "Academic Advisement Request"; $cin = $_REQUEST['cin']; $fname = $_REQUEST['fname']; $lname = $_REQUEST['lname']; $email = $_REQUEST['email'] ; $phone = $_REQUEST['phone']; $major = $_REQUEST['major']; $standing = $_REQUEST['standing']; if ($cin == '' || $fname == '' || $lname == '' || $email == '' || $phone == '' || $major == '') {print "There was an error submitting your request. You left one or more fields blank.

Please go back fill in all fields in the form and then click the Submit button again."; exit(1);} else { if ($standing == "freshman" && $major == "CE" || $standing == "freshman" && $major == "ECE" || $standing == "freshman" && $major == "ME" || $standing == "sophmore" && $major == "CE" || $standing == "sophmore" && $major == "ECE" || $standing == "sophmore" && $major == "ME") {$to = "ecrosby@cslanet.calstatela.edu";} else { if($major == "CS") {$to = "ttrejo@cslanet.calstatela.edu";} if($major == "CE") {$to = "dmelend@cslanet.calstatela.edu";} if($major == "ECE") {$to = "aleiva@cslanet.calstatela.edu";} if($major == "ME") {$to = "lhwang@cslanet.calstatela.edu";} if($major == "TECH") {$to = "jhundley@cslanet.calstatela.edu";} } $message = "CIN #: $cin \n\nFirst Name: $fname \n\nLast Name: $lname \n\nEmail: $email \n\nPhone: $phone \n\nMajor: $major \n\nClass Standing: $standing"; $headers = "From: $email"; $sent = mail($to, $subject, $message, $headers) ; if($sent) {print "Your advisement request was emailed successfully"; } else {print "We encountered an error sending your advisement request email"; } } } ?>