Jump to content

Recommended Posts

Hi everybody, Im not too good at php and I've used a copy and paste contact form on my website, it all seems to work grand yet once a user submits the form, if it errors my error page doesnt show my footer div, I cant understand it and if anybody can 'suss' this out ill be very grateful, heres my page

 

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Liamm v2</title>
<link href="stylesheets/main.css" rel="stylesheet" type="text/css" />
</head>

<body>


<div id="browser">
<div id="wrapper">

    <div id="header-row">
    	<div id="logo"><img src="images/logo.png" alt="Liam | Brand Consultancy and Graphic Design" width="164" height="126" border="0" usemap="#Map" />
          <map name="Map" id="Map">
            <area shape="rect" coords="6,80,108,119" href="index.html" alt="Liam | Brand Consultant | Home" />
          </map>
    	</div>
   	  
      <div id="navcontain">
      <div id="nav-menu"> 
        <ul>
        	<li><a href="showcase.html" title="Showcase">Showcase</a></li>
            <li><a href="about.html" title="About">About</a></li>
            <li><a href="capabilities.html" title="Capabilities">Capabilities</a></li>
            <li><a href="blog.html" title="Blog">Blog</a></li>
          <li><a href="contact.php" title="Contact">Contact</a></li>
        </ul></div>
        
        <div id="home-cont">
          <h1>Details</h1>
     
      
        liam@liamm.co.uk<br />
        07926 177 318<br />
        <br />
        Runcorn, Cheshire  </div>
            
      </div>
      <div id="work-quote">
        <div class="quotespace"></div>
        <div id="quote">Contact</div>
      </div>
      <div id="selectwork">
       <div id="spacer"><br />
           <br />
       </div>
       <div class="contact-cont">
         
         <div class="contact-left"><?php

$ip = $_POST['ip'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
$visitor = $_POST['visitor'];
$visitormail = $_POST['visitormail'];
$notes = $_POST['notes'];
$attn = $_POST['attn'];


if (eregi('http:', $notes)) {
die ("Do NOT try that! ! ");
}
if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo "<h2>Use Back - Enter valid e-mail</h2>\n";
$badinput = "<h2>Feedback was NOT submitted</h2>\n";
echo $badinput;
die ("Go back! ! ");
}

if(empty($visitor) || empty($visitormail) || empty($notes )) {
echo "<h2>Use Back - fill in all fields</h2>\n";
die ("Use back! ! ");
}

$todayis = date("l, F j, Y, g:i a") ;

$attn = $attn ;
$subject = $attn;

$notes = stripcslashes($notes);

$message = " $todayis [EST] \n
Attention: $attn \n
Message: $notes \n
From: $visitor ($visitormail)\n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
";

$from = "From: $visitormail\r\n";


mail("YourEmail", $subject, $message, $from);

?>

<p align="center">
Date: <?php echo $todayis ?>
<br />
Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> )
<br />

Attention: <?php echo $attn ?>
<br />
Message:<br />
<?php $notesout = str_replace("\r", "<br/>", $notes);
echo $notesout; ?>
<br />
<?php echo $ip ?>

<br /><br />
<a href="contact.php"> Next Page </a>
</p> 
</div>
         <div class="contact-right"></div>
         
         
       </div>
       <div id="footer">
         
         <div class="copy">
         <strong>Copyrights © 2008/09</strong><br />
          All work is the property of<br />
           Liam Gallagher.<br />
        
        
    </div>
    
    <div class="footlinks">
        <strong>Link Love</strong><br />
          
          <a href="http://www.kelvinwins.com" target="_blank">Kelvinwins</a><br />
          <a href="http://www.lucywoolford.com/" target="_blank">Lucy Woolford</a><br />
          <a href="http://theworkof.co.uk/" target="_blank">The Work Of</a><br />
          <a href="http://www.alexminchin.co.uk" target="_blank">Alex Minchin</a>
       
          
    </div>    
    
    <div class="footlinks">
       
        <a href="http://iamamountain.co.uk" target="_blank"><br />
        Ali Mountain</a><br /><a href="http://www.mggm.co.uk" target="_blank">Matt Guttmann</a><br /><a href="http://www.ihdesigns.co.uk/" target="_blank">Ilya Haycock</a><br /><a href="http://www.danjardine.co.uk/" target="_blank">Dan Jardine</a></div>
    <div class="footlinks"> <br/>
      <br/>
      <a href="http://iamamountain.co.uk" target="_blank"></a><br />
    </div>
    <div class="footlinks"> <br/>
      <br/>
      <a href="http://iamamountain.co.uk" target="_blank"></a><br />
    </div>
    <div class="footlinks"> <br/>
      <br/>
      <a href="http://iamamountain.co.uk" target="_blank"></a><br />
    </div>
    <div class="footlinks">
      <strong>Inspiration</strong><br/>
     <a href="http://www.subtraction.com/" target="_blank">Khoi Vinh</a><br />
          <a href="http://www.thegridsystem.org/" target="_blank">The Grid System</a><br />
       
    </div>           
       </div></div></div></div></div>
       </div>
      </div>
</div>
</div>
</body>
</html>

 

Thanks in advance !

Link to comment
https://forums.phpfreaks.com/topic/162743-solved-contact-form-breaking-page/
Share on other sites

$badinput = "<h2>Feedback was NOT submitted</h2>\n";
echo $badinput;
die ("Go back! ! ");
}

if(empty($visitor) || empty($visitormail) || empty($notes )) {
echo "<h2>Use Back - fill in all fields</h2>\n";
die ("Use back! ! ");
}

 

you are using die() which will print out the string in the parentheses and exit out of the script so anything after that does not get processed, html or php.

 

if you want it to show your foot just change die to echo.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.