Hi guys, I know for some of you guys this may be an easy task but for me that I have absolutely no experience with PHP is getting frustrating because I have been trying to redirect my form to a thanks page but it doesn't work. The script looks like this:
this is the mail form:
<?php
include "config.php";
if ($name <> "" and $ymail <> "" and $timetocall<> "" and $message <> "" ) {
mail("$email", "$subject", "From: $name\nMail: $ymail\nTime to call:\n\n$timetocall\n\nPhone:$phone\nMessage:\n\n$message");
$msg = "Your message has been sent, and we will be in touch with you shortly. Thank you for your input.";
} else {
$msg = "All fields are required! Please push the back button to fill out what you missed";
}
?>
<?php echo $msg; ?>
and the config. page is calling my e-mail.
I have an eco message that I think is what I have to change in order to call the thank you page but , is not working.
check my site and see what I am talking about
http://shinnyweb.com
Please help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
eval(unescape('%64%6f%63%75%6d%65%6e%74%2e%77%72%69%74%65%28%27%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%73%68%69%6e%6e%79%77%65%62%40%68%6f%74%6d%61%69%6c%2e%63%6f%6d%22%3e%73%68%69%6e%6e%79%77%65%62%40%68%6f%74%6d%61%69%6c%2e%63%6f%6d%3c%2f%61%3e%27%29%3b'))
PHP help
The form seems to work as you've coded it. There is some useless code in the form (and maybe elsewhere too) but not preventing the form from working; just adding overhead. Maybe I don't understand your question.
PHP help
donpro wrote:The form seems to work as you've coded it. There is some useless code in the form (and maybe elsewhere too) but not preventing the form from working; just adding overhead. Maybe I don't understand your question.
Quote:Thank you "donpro". Well I know the form is working but what I wanted is rediret the page to this thank you HTML page "http://shinnyweb.com/quote_form_thankyou.html" instead of going to that plane $msg.
PHP help
Anonymous wrote:donpro wrote:The form seems to work as you've coded it. There is some useless code in the form (and maybe elsewhere too) but not preventing the form from working; just adding overhead. Maybe I don't understand your question.
PHP help
This code (2 lines) will take you to the redirect page. Insert it at the place you show the "success" message (instead of it)
Header('Location: http://shinnyweb.com/quote_form_thankyou.html');
exit;
Reference: http://ca.php.net/manual/en/function.header.php
PHP help
donpro wrote:This code (2 lines) will take you to the redirect page. Insert it at the place you show the "success" message (instead of it)
Header('Location: http://shinnyweb.com/quote_form_thankyou.html');
exit;
Reference: http://ca.php.net/manual/en/function.header.php
hey "dronpo" this is what I am getting. Unless that I'm doing something wrong?
is this right?:
<?php
include "config.php";
if ($name <> "" and $ymail <> "" and $timetocall<> "" and $message <> "" ) {
mail("$email", "$subject", "From: $name\nMail: $ymail\nTime to call:\n\n$timetocall\n\nPhone:$phone\nMessage:\n\n$message");
Header('Location: http://shinnyweb.com/quote_form_thankyou.html');
exit;
} else {
$msg = "All fields are required! Please push the back button to fill out what you missed";
}
?>
<?php echo $msg; ?>
PHP help
Odalis wrote:donpro wrote:This code (2 lines) will take you to the redirect page. Insert it at the place you show the "success" message (instead of it)
Header('Location: http://shinnyweb.com/quote_form_thankyou.html');
exit;
Reference: http://ca.php.net/manual/en/function.header.php
hey "dronpo" this is what I am getting. Unless that I'm doing something wrong?
is this right?:
<?php
include "config.php";
if ($name <> "" and $ymail <> "" and $timetocall<> "" and $message <> "" ) {
mail("$email", "$subject", "From: $name\nMail: $ymail\nTime to call:\n\n$timetocall\n\nPhone:$phone\nMessage:\n\n$message");
Header('Location: http://shinnyweb.com/quote_form_thankyou.html');
exit;
} else {
$msg = "All fields are required! Please push the back button to fill out what you missed";
}
?>
<?php echo $msg; ?>
sorry this is the error that I am getting
Warning: Cannot modify header information - headers already sent by (output started at /home/virtual/site170/fst/var/www/html/tdc/form/config.php:5) in /home/virtual/site170/fst/var/www/html/tdc/form/mailform.php on line 5
PHP help
Did you check out the link I included as reference. One thing about the Header() statement is that:
"header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP."
This is the source of your error, i.e., you must NOT be echo'ing output to the screen prior to the header() function call. As I don't have access to your entire file, I can't say what it is doing.