Guidance needed on Redirect Webpage

Dear Forumers,

I just joined today and sorry for my lack of knowledge on PHP. Hope that many of you here can guide me.

I would like to do a redirection to my website after a contact form message is filled. With the code below, it does not seem to work. It just stuck at the page saying that “Your mail was sent successfully”. I tried what this page - http://www.phphelp.com/forum/index.php/topic,10291.msg37712.html#msg37712 says and it still didn’t work.

  1. Which part of my code is wrong?
  2. How do I ensure direction happens after 2 seconds?
  3. How can I show a different text with hyperlink to another page if the contact form message was failed to sent?

[php]

<?php $to = "[email protected]"; $name = $_REQUEST['name']; $subject = "Feedback from customer ".$name."!"; $email = $_REQUEST['mail'] ; $message = $_REQUEST['message'] ; $headers = "From: $email"; $sent = mail($to, $subject, $message, $headers) ; if($sent) {print "Your mail was sent successfully"; } else {print "We encountered an error sending your mail"; } ?> <?php header("Refresh: 2; location=http://www.orangemobile.com.my/contact.html"); ?>

[/php]

Many thanks in advance.

Topic can be closed. Problem Resolved.

Sponsor our Newsletter | Privacy Policy | Terms of Service