Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

form to email - pause and redirecting after submission

Posted on 2004-04-20
2
Medium Priority
?
853 Views
Last Modified: 2012-05-07
Hi, I've got an html form which basically sends output to a php script, which emails it  like so :
<form action="send.php" method="post" name="quoteform" id="quoteform">

and this is send.php
<?php
$to = "me@abc.com"; // E-mail address to send mail to.
$subject = "Online Quote Form"; //Subject of the e-mail
$message = "Quote request received:
Name: $ctcName
Tel: $ctcTel
E-mail address: $ctcEmail;

mail($to, $subject, $message, "From: $name <$ctcEmail>\nX-Mailer: PHP/" . phpversion());
mail($cc, $subject, $message, "From: $name <$ctcEmail>\nX-Mailer: PHP/" . phpversion());
echo "redirecting..please wait";
sleep(8);    //slight pause to display message above
header("Location: http://www.google.com/"); /* Redirect browser */
exit;
?>

Well, I get the following error:
Warning: Cannot modify header information - headers already sent by (output started at /home/mydomain/public_html/send.php:2) in /home/mydomain/public_html/send.php on line 30

I figured that prob is because  header can only be used as the first statement in a script yes? So is there a way I can redirect after displaying a message like 'thank you' for a few seconds?

Thanks...
0
Comment
Question by:skylabel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 12

Accepted Solution

by:
venkateshwarr earned 2000 total points
ID: 10874975
You can attach this script to your script

<HTML>
<HEAD>
<script>  
function redirect()
{
 window.location.href='http://www.google.com';
}
</script>
</HEAD>

<BODY onload="setTimeout('redirect()', 5000)">
Thank you..
Redirecting in 5 secs..
</BODY>
</HTML>
0
 
LVL 12

Expert Comment

by:venkateshwarr
ID: 10874988
or

<HTML>
<HEAD>
<META HTTP-EQUIV="Refresh" CONTENT="5; URL=http://www.google.com">
</HEAD>
<BODY>
Redirecting in 5 secs..
</BODY>
</HTML>
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question