What is confusing me is that in this HTML sidebar I add a PHP contact form and it wont submit. I am using a code that will be blocked when trying to send because it is requiring more fields but it never gets the chance to open the php file.
Here is the side bar:
[php]
Have a question?
<textarea name="comment" id="comments" placeholder="Question" width="90%"></textarea>
<center>
<input type="submit" name="submit" value="Send" id="submit" class="button darkblue"/></center>
</form></div>[/php]
Here is the PHP:
[php]<?php
if(!$_POST) exit;
function tommus_email_validate($email) { return filter_var($email, FILTER_VALIDATE_EMAIL) && preg_match(’/@.+./’, $email); }
$name = $_POST[‘name’]; $email = $_POST[‘email’]; $comments = $_POST[‘comments’];
if(trim($name) == ‘’) {
exit(‘
} else if(trim($name) == ‘Name’) {
exit(‘
} else if(trim($email) == ‘’) {
exit(‘
} else if(!tommus_email_validate($email)) {
exit(‘
} else if(trim($website) == ‘Website’) {
exit(‘
} else if(trim($website) == ‘’) {
exit(‘
} else if(trim($comments) == ‘Message’) {
exit(‘
} else if(trim($comments) == ‘’) {
exit(‘
} else if( strpos($comments, ‘href’) !== false ) {
exit(‘
} else if( strpos($comments, ‘[url’) !== false ) {
exit(‘
} if(get_magic_quotes_gpc()) { $comments = stripslashes($comments); }
//ENTER YOUR EMAIL ADDRESS HERE
$address = ‘@’;
$e_subject = 'You’ve been contacted by ’ . $name . ‘.’;
$e_body = “You have been contacted by $name with a budget of $website.” . “\r\n” . “\r\n”;
$e_content = “”$comments"" . “\r\n” . “\r\n”;
$e_reply = "Contact $name $last via, $email
";
$msg = wordwrap( $e_body . $e_content . $e_reply, 70 );
$headers = “From: $address” . “\r\n”;
$headers .= “Reply-To: $email” . “\r\n”;
$headers .= “MIME-Version: 1.0” . “\r\n”;
$headers .= “Content-type: text/plain; charset=utf-8” . “\r\n”;
$headers .= “Content-Transfer-Encoding: quoted-printable” . “\r\n”;
if(mail($address, $e_subject, $msg, $headers)) { echo “
Quote Sent Successfully.
Thank you $name, your quote has been submitted to us.
I would post a link to the site but I don’t want search engines picking up the link.