Page 1 of 1

Mailform

Posted: Wed May 22, 2002 8:10 am
by blomman
Hi im new on this forum, i have a problem with a mailform, onsubmit it sends the mail, but dosent return the new php-page....
Anyone please!

This is my code:

<?$to_email="michael.blomberg@automotorsport.se";
$subject="Intresserad av en bil";
$message="Hej jag heter $namn\nJag ar intresserad av en bil som du har ilager\nDu kan ringa mig pa telefonnummer:$tel\neller skicka ett mail till $dinmail\n";
mail($to_email,$subject,$message);
header("Location: tackar.php");------But this dosent work!!
exit;?>

Im getting this in the browser window:

Warning: Cannot add header information - headers already sent by (output started at /home/httpd/html/linden/mail.php:2) in /home/httpd/html/linden/mail.php on line 2

Posted: Wed May 22, 2002 8:15 am
by mydimension
the header function dosen't work with relative url's. try using this:

Code: Select all

Header("Location: http://" . $_SERVER['HTTP_HOST'] . "/takar.php");
edit
-----
do not include the color stuff in the middle theren dosen't work with relative url's. try using this:

Code: Select all

Header("Location: http://" . $_SERVER&#1111;'HTTP_HOST'] . "/takn dosen't work with relative url's. try using this:

Code: Select all

Header("Location: http://" . $_SERVER['HTTP_HOST'n dosen't work with relative url's. try using this:

Code: Select all

Header("Location: http://" . $_SERVER&#1111;'HTTP_HOST'] . "/takar.php");
[/php:1:fe889e9n dosen't work with relative url's. try using this:

Code: Select all

Header("Location: http://" . $_SERVER&#1111;'HTTP_HOST'] . "/takar.php");
[/n dosen't work with relative url's. try using this:

Code: Select all

Header("Location: http://" . $_SERVER&#1111;'HTTP_HOST'] . "/takar.php");
edit
-----
dl's. try using this:

Code: Select all

Header("Location: http://" . $_SERVER['HTTP_HOST'] . "/takar.php");
edit
-----
do not include the color stuff in the mi http://" . $_SERVER['HTTP_HOST'] . "/takar.php");
[/php:1:fe889e9e2n dosen't work with relative url's. try using this:

Code: Select all

Header("Location: http://" . $_SERVER&#1111;'HTTP_HOST'] . "/takar.php");
n dosen't work with relative url's. try using this:

Code: Select all

Header("Location: http://" . $_SERVER['HTTP_HOST'] . "/tn dosen't work with relative url's. try using this:

Code: Select all

Header("Location: http://" . $_SERVER['HTTP_HOST'] . "/takar.php");
edit
-----
do not include the color stuff in the middle therer stuff in the middle thererl's. try using this:

Code: Select all

Header("Location: http://" . $_SERVER['HTTP_HOST'] . "/takar.php");
edit
-----
do not include the color stuff in the middle thereHeader("Location: http://" . $_SERVER['HTTP_HOST'] . "/takar.php");


edit
-----
do not include the color stuff in the middle there

Posted: Wed May 22, 2002 8:28 am
by blomman
Thanks for your time....But now im getting this:

Parse error: parse error in /home/httpd/html/linden/mail.php on line 3

Posted: Wed May 22, 2002 8:44 am
by cwcollins
correction...



Header("Location: http://". $_SERVER['HTTP_HOST'] . "/takar.php");

Posted: Wed May 22, 2002 8:55 am
by blomman
Thanks again you guys are to kind......This is my code:



<?$to_email="michael.blomberg@automotorsport.se";
$subject="Intresserad av en bil";
$message="Hej jag heter $namn\nJag ar intresserad av en bil som du har ilager\nDu kan ringa mig pa telefonnummer:$tel\neller skicka ett mail till $dinmail\n";
mail($to_email,$subject,$message);
Header("Location: http://". $_SERVER['HTTP_HOST'] . "/tackar.php");
exit;?>

And now im getting this again:

Warning: Cannot add header information - headers already sent by (output started at /home/httpd/html/linden/mail.php:2) in /home/httpd/html/linden/mail.php on line 2

Posted: Wed May 22, 2002 8:57 am
by cwcollins
make sure you don't have any empry lines before the <?.

Posted: Thu May 23, 2002 2:49 am
by blomman
Hi again!
Whitespace was the major problem, but now the url is not found....

Header("Location: http://". $_SERVER['HTTP_HOST'] . "/takar.php");

Mail.php and takar.php is both in the root of the server, strange why it cant find the url??
Anyone?

Posted: Thu May 23, 2002 3:04 am
by mikeq
Change the URL back to what you had originally.

header("Location: tackar.php");

That is the way I do header stuff and never had any problem.

Mike

Posted: Thu May 23, 2002 3:15 am
by blomman
Thanks man!
No it works fine.....