Jump to content

thank you page shows 2 footers


j5uh

Recommended Posts

I have a form that i'm working with and once you hit register it shows 2 footers. How can I fix this?

 

 

Here is what i have:

 

<?php
// Connects to your Database
mysql_connect("xx", "xx", "xx") or die(mysql_error());
mysql_select_db("xx") or die(mysql_error());

//This code runs if the form has been submitted
if (isset($_POST['submit'])) {

//This makes sure they did not leave any fields blank
if (!$_POST['firstname'] | !$_POST['lastname'] | !$_POST['address'] | !$_POST['city'] | !$_POST['state'] | !$_POST['zipcode'] | !$_POST['email'] ) {
die('You did not complete all of the required fields');
}

// checks if the email is in use
if (!get_magic_quotes_gpc()) {
$_POST['email'] = addslashes($_POST['email']);
}
$usercheck = $_POST['email'];
$check = mysql_query("SELECT email FROM xx WHERE email = '$usercheck'")
or die(mysql_error());
$check2 = mysql_num_rows($check);

//if the name exists it gives an error
if ($check2 != 0) {
die('Sorry, the E-mail '.$_POST['email'].' is already in use.');
}

// now we insert it into the database
$insert = "INSERT INTO xx (firstname, lastname, address, city, state, zipcode, country, phone, email)
VALUES ('".$_POST['firstname']."', '".$_POST['lastname']."', '".$_POST['address']."', '".$_POST['city']."', '".$_POST['state']."', '".$_POST['zipcode']."', '".$_POST['country']."', '".$_POST['phone']."', '".$_POST['email']."')";
$add_member = mysql_query($insert);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="includes/main.css" />
<link rel="stylesheet" type="text/css" href="includes/typography.css" />
</head>

<body>

   <!-- Begin Wrapper -->
   <div id="wrapper">
   
         <!-- Begin Logo -->
		<?php include("header.php"); ?>
         <!-- End Header -->

	 <!-- Begin Navigation -->
         <div id="navigation">

	       <div align="center"> <?php include("nav.php"); ?> </div>
         </div>
<!-- End Navigation -->

	 <!-- Begin Left Column -->
	 <!-- Begin background -->
	 <div id="background">
         
         <div id="leftcolumn">

	       Left Column		 </div>
<!-- End Left Column -->

	 <!-- Begin Right Column -->
	 <div id="rightcolumn">
	       
          <h3>Attendee  Registration	  </h3>	 
            
              <p> Thank you for your registration. Your registration will be processed in the next 24 hours. See you soon in Las Vegas.</p>
                  <br /><br /><br /><br /><br /><br /><br /><br>
         </div>
<!-- End Right Column -->
	 </div>
<!-- End background --> 
<!-- Begin Footer -->
	 <div id="footer"> <?php include("footer.php"); ?></div>
 <!-- End Footer -->

   </div>
   <!-- End Wrapper -->
   
</body>
</html>


<?php
}
else
{
?>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="includes/main.css" />
<link rel="stylesheet" type="text/css" href="includes/typography.css" />
</head>

<body>

   <!-- Begin Wrapper -->
   <div id="wrapper">
   
         <!-- Begin Logo -->
		<?php include("header.php"); ?>
         <!-- End Header -->

	 <!-- Begin Navigation -->
         <div id="navigation">

	       <div align="center"> <?php include("nav.php"); ?> </div>
         </div>
<!-- End Navigation -->

	 <!-- Begin Left Column -->
	 <!-- Begin background -->
	 <div id="background">
         
         <div id="leftcolumn">

	       Left Column		 </div>
<!-- End Left Column -->

	 <!-- Begin Right Column -->
	 <div id="rightcolumn">
	       
          <h3>Attendee  Registration		 
            
              <br />
              </h3>
       <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<table border="0">
<tr><td>First Name:</td><td>
<input type="text" name="firstname" maxlength="60">
</td></tr>
<tr><td>Last Name:</td><td>
<input type="text" name="lastname" maxlength="60">
</td></tr>
<tr><td>Address:</td><td>
<input type="text" name="address" maxlength="60">
</td></tr>
<tr><td>City:</td><td>
<input type="text" name="city" maxlength="60">
</td></tr>
<tr><td>State:</td><td>
<input type="text" name="state" maxlength="60">
</td></tr>
<tr><td>ZIP Code:</td><td>
<input type="text" name="zipcode" maxlength="20">
</td></tr>
<tr><td>Country:</td><td>
<input type="text" name="country" maxlength="60">
</td></tr>
<tr><td>Phone:</td><td>
<input type="text" name="phone" maxlength="60">
</td></tr>
<tr><td>E-mail:</td><td>
<input type="text" name="email" maxlength="60">
</td></tr>
<tr><th colspan=2><input type="submit" name="submit" value="Register"></th></tr> </table>
</form>

<?php
}
?> 
	 </div>
<!-- End Right Column -->

	 </div>
<!-- End background --> 

   </div>
   <!-- End Wrapper -->
   
</body>
</html>

 

Link to comment
https://forums.phpfreaks.com/topic/100341-thank-you-page-shows-2-footers/
Share on other sites

You've got your enter/exit PHP of fiddly.

 

Because both sections of your HTML that contain the footer are outside of the php code they are both being rendered. It doesn't matter that you have entered php to create the else statement in between them.

 

All you need to do is put your HTML into php using print or echo. e.g

 

print "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="includes/main.css" />
<link rel="stylesheet" type="text/css" href="includes/typography.css" />
</head>

<body>

   <!-- Begin Wrapper -->
   <div id="wrapper">
   
         <!-- Begin Logo -->
		<?php include("header.php"); ?>
         <!-- End Header -->

	<!-- Begin Navigation -->
         <div id="navigation">";

 

Although you'll probably have to turn every " into '.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.