# Little php issue

**URL:** <https://forum.kirupa.com/t/little-php-issue/236031>\
**Category:** Uncategorized\
**Created:** [August 16, 2007, 4:46pm UTC](https://forum.kirupa.com/t/little-php-issue/236031 "2007-08-16T16:46:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![killahert](https://avatars.discourse-cdn.com/v4/letter/k/6f9a4e/32.png) [@killahert](https://forum.kirupa.com/u/killahert)\
**Post date:** [August 16, 2007, 4:46pm UTC](https://forum.kirupa.com/t/little-php-issue/236031/1 "2007-08-16T16:46:06Z")

</div>

I am having a hard time attaching footer to my document the footer attaches ok when the message is sent, but if there is error it doesn’t attach footer

```php

(header, body, blah blah (I skipped that part)
<div class="main_window" id="content_bg"><p><br>
<div id="php">

<?php
if(isset($_POST['submit'])) {

$to = "blah@gmail.com";
$subject = "web form";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$message = $_POST['message'];
 
$body = "From: $name_field
 E-Mail: $email_field
 Message:
 $message";
if (!eregi ('^[[:alnum:]][a-z0-9_\.\-]*@[a-z0-9\.\-]+\.[a-z]{2,4}$', stripslashes(trim($_POST['email'])))) 
{
     echo '*wrong email;
     exit;
}  

$headers = "From: $email";
mail($to, $subject, $message, $headers);   
echo "message sent: $to!";
mail($to, $subject, $body);

} else {

echo "Oops!";

}
?>
<?php include("footer.php"); ?>

```
