Php contact form question

  • lplplpx3
  • Novice
  • Novice
  • No Avatar
  • Joined: May 30, 2007
  • Posts: 23
  • Status: Offline

Post January 28th, 2011, 12:06 am

This code is from the bottom of a php contact submission form. How can I change the code to direct to or display a specified web page if the email was successful and another if not in order to stop this generic page from showing. Thanks.

<?php if(isset($emailSent) == true) { ?>
<div class="ok">
<h1>Thanks, <?php echo $name;?></h1>
<p>Your email was successfully sent. We will be in touch soon.</p>
</div>
<?php } ?>


<?php if(isset($hasError) ) { ?>
<div class="error2">There was an error submitting the form.</div>
<?php } ?>
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post January 28th, 2011, 12:06 am

  • vikasgautam
  • Newbie
  • Newbie
  • User avatar
  • Joined: Jan 19, 2011
  • Posts: 11
  • Status: Offline

Post February 3rd, 2011, 12:28 am

first of all if you recivinf the error of this code then chek you tag for the whole html page if you want to change the msg send successfully of redirect to other page then

you can ue header("location:index.php")
by this you directed to your home page durectly after submission succesfully
  • lplplpx3
  • Novice
  • Novice
  • No Avatar
  • Joined: May 30, 2007
  • Posts: 23
  • Status: Offline

Post February 3rd, 2011, 5:43 am

Great thanks much. I'll try it.
  • techRobo
  • Born
  • Born
  • No Avatar
  • Joined: Feb 03, 2011
  • Posts: 3
  • Status: Offline

Post February 4th, 2011, 11:23 am

try this..
<?php if(isset($emailSent) == true) { ?>
<div class="ok">
<h1>Thanks, <?php echo $name;?></h1>
<p>Your email was successfully sent. We will be in touch soon.</p>
</div>
echo "<script>window.location='index.php';</script>";


<?php } ?>


<?php if(isset($hasError) ) { ?>
<div class="error2">There was an error submitting the form.</div>
echo "<script>window.location='index.php';</script>";
<?php } ?>

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 142 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.