// For error checking on required fields you will need to put this somewhere in // contact.inc.php to alert the user that there are entry errors: // echo $required; <-- this needs to be inside php tags. // Create the "if" statements below for each field you want to validate. // Set the two variables below. // This is who gets emailed with the contents when the form is submitted $email_form_to = "info@cslovettbooks.com"; // This appears in the subject line when the form gets emailed. $email_form_subject = "Contact Request from {$_SERVER['SERVER_NAME']}"; if( $action == "submitted" ){ $required = ""; /* if( $name == "" ){ */ /* $required .= "Name is a required field
"; */ /* } */ /* if( $address1 == "" ){ */ /* $required .= "Address is a required field
"; */ /* } */ /* if( $city == "" ){ */ /* $required .= "City is a required field
"; */ /* } */ /* if( $state == "" ){ */ /* $required .= "State is a required field
"; */ /* } */ /* if( $zip == "" ){ */ /* $required .= "Zip is a required field
"; */ /* } */ /* if( $phone == "" ){ */ /* $required .= "Phone is a required field
"; */ /* } */ /* if( $email == "" ){ $required .= "Email is a required field
"; } */ if( $required == "" ){ $body .= "Name: ".$name."\n"; $body .= "Phone: ".$phone."\n"; $body .= "Email: ".$email."\n"; $body .= "Address1: ".$address."\n"; $body .= "Address2: ".$address2."\n"; $body .= "City: ".$city."\n"; $body .= "State: ".$state."\n"; $body .= "Zip: ".$zip."\n"; $body .= "Comment: ".$comment."\n"; mail( $email_form_to, $email_form_subject, $body, "From: $email\r\n"."Reply-To: $email\r\n"."X-Mailer: PHP/" . phpversion() ); include("thankyou.inc.php"); } } if( $action == "" || $required != ""){ include("freebook.inc.php"); } ?>