From the contact form perspective, my suggestion would be to create a new PHP file to process the form.
Example: contact.php
PHP Code:
<?php
$to = '';
$subject = 'Email From';
$name = $_POST['name'];
$cname = $_POST['cname'];
$number = $_POST['number'];
$mail = $_POST['mail'];
$message = $_POST['message'];
$body = <<<EMAIL
$name
$cname
$number
$mail
$message
EMAIL;
$header = "From: $name";
if($_POST){
if($name == '' || $number == '' || $mail == '' || $message == ''){
$feedback = 'fill out all the fields';
}else{
mail($to, $subject, $body, $header);
$feedback = 'Message sent';
}
$_SESSION['feedback'] = $feedback;
header('Location: index.php');
}
?>
Then point your form action to contact.php
In your template, change this
PHP Code:
<p id="contactfeedback"><?php echo $feedback; ?></p>
To
PHP Code:
<p id="contactfeedback">
<?php
$feedback = '';
if (isset($_SESSION['feedback']))
{
$feedback = $_SESSION['feedback'];
unset($_SESSION['feedback']);
}
echo $feedback;
?>
</p>
From what I can tell, Wordpress is hijacking your form submission, so it is interfering with your form. By moving it to a separate file, it should help ease that pain.
Bookmarks