Thanks a lot, NogDog!
I was able to fix the rest of the problems syntaxically. It makes more sense now. I have been following the howto site, and am wondering if the tutorial failed to mention a step or I skipped something. I would love for you to be my second pair of eyes to see what's wrong with the code.
When I tried the email form, no errors came up and only shows a white page. I also tried inputting an incorrect e-mail to see if it would tell me I got an invalid e-mail. Nothing happened. I'll link you to the following problematic page as well PHP code and the contact source.
I am also getting nothing in my inbox.
http://tdkohnen.com/contact.php
<?php
if (!isset($_POST['email'])) {
$email_to="tdkohnen@gmail.com";
$email_subject="Tdkohnen.com Contact Reply";
}
function died($error) {
echo "Error(s) are found with your submission. Please check the info you typed in and send again. ";
echo "These errors appear below.<br /><br /> ";
echo $error."<br /><br />";
echo "Pleae go back and fix these errors. <br /> <br />";
die ();
}
if (!isset($_POST['first']) ||
!isset($_POST['email']) ||
!isset($_POST['comments'])) {
die('Sorry, there is a problem with your submission.');
}
$first=$_POST ['first']; //required
$email=$_POST ['email']; //required
$comments=$_POST['comments']; //required
$error_message= " ";
$email_exp= '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
if(!preg_match($email_exp,$email_from)) {
$error_message .='The Email Address you entered does not appear to be valid.<br />'; }
$string_exp ="/^[A-Za-z .'-]+$/";
if(!preg_match($string_exp, $first)) {
$error_message .= 'The First Name you entered does not appear to be valid. Do you not have one?<br />';
if(strlem($error_message) < 2 ) {
$error_message .= 'The comments you entered is not valid.<br />';
}
if(strlem($error_message) >0 ){
died($error_message);
}
$email_message = "Form details below. \n\n";
function clean_string ($string) {
$bad = array ("content-type", "bcc:", "to:","cc:","href");
return str_replace($bad, "", $string);
}
$email_message .="First name:" .clean_string($first_name)."\n";
$email_message .="Email:" .clean_string($email)."\n";
$email_message .="Comments:" .clean_string($comments)."\n";
//create email headers
$headers='From:'.$email_from. "\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers); ?>
Thank you for contacting me. I'll be in touch with you very soon.
<?php
}
?>
Contact source (nix'd the unnecessary code)
<p>If you just want to get in touch with me by email or form, you can email me using the form.</p>
<div id="contact"> <form name="contact" method="post" action="sendform_email.php">
<p> <label for="first">First Name *</label>
<input class="first" type="text" name="first" maxlength="50" size="30"></p>
<p> <label for="email">Email Address*</label>
<input class="email" type="text" name="email" maxlength="80" size="30"></p>
<p> <label for="comments">Comments*</label>
<textarea class="comments" name="comments" cols="50" rows="10"></textarea></p>
<p>
<input class="submit" type="submit" value="Send"><a href="sendform_email.php">Submit</a></p>
</form>
</div>