Php contact form question

  • lplplpx3
  • Novice
  • Novice
  • lplplpx3
  • Posts: 23

Post 3+ Months Ago

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
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • vikasgautam
  • Newbie
  • Newbie
  • User avatar
  • Posts: 11

Post 3+ Months Ago

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
  • lplplpx3
  • Posts: 23

Post 3+ Months Ago

Great thanks much. I'll try it.
  • techRobo
  • Born
  • Born
  • techRobo
  • Posts: 3

Post 3+ Months Ago

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 41 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
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.