English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Okay, here is the deal. I am starting out simple, so here is what I made...
Page one:email.php


Name:


Email:

Message:







and page two:
sendmail.php


$name = $_POST['name'];
$email = $_POST['email'] ;
$message = $_POST['message'] ;
mail( "tim.nealon@yahoo.com", "Feedback Form Results",
$message, "From: $email" );
header( "Location: http://www.yahoo.com" );
?>


The E-Mail goes through fine. The problem is, the 'header' doesn't redirect to a site I specify, in this ex, yahoo.com...it gives me this message when I submit the form "Warning: Cannot modify header information - headers already sent by "my sendmail.php page"
Any ideas?

2007-03-07 17:53:20 · 3 answers · asked by tim.nealon 1 in Computers & Internet Programming & Design

3 answers

If you want to send a header (via header command) it is not allowed to print out any other characters before the header command. remove all html-tags (such as body) etc., dont use the echo command, and remove all white spaces.
so the file should look like:
1 2 // your php code without any outputs
... ....
4 ?>

php.net says: "Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file."

then it should work

2007-03-07 18:22:46 · answer #1 · answered by jaegermeister_jr 1 · 0 0

Neither of the above! you could replace the historic previous of the browser as quickly as the type is processed. So, if/whilst the person clicks on the lower back button, he does no longer return to the type, yet continues to be the place he's!

2016-11-23 14:47:52 · answer #2 · answered by ? 4 · 0 0

remove and tags from sendmail.php
Header will work.

2007-03-08 00:53:40 · answer #3 · answered by Atif Majid 3 · 0 0

fedest.com, questions and answers