dryan11 Posted May 18, 2009 Share Posted May 18, 2009 I've done many different searches looking for an answer to my issue. Everything is working fine except the redirect. From what I've read it should work fine, but it never redirects. Here is my code: <?php // Variables $from = $_REQUEST['FieldData0']; $email = $_REQUEST['FieldData1']; $phone = $_REQUEST['FieldData2']; $company = $_REQUEST['FieldData3']; // User information $content = "Name: $from\r\n"; $content = "$content Email Address: $email\r\n"; $content = "$content Phone Number: $phone\r\n"; $content = "$content Company: $company\r\n"; // Wrap content to abide by php rules $content = wordwrap($content, 70); // Send email mail('[email protected]', 'Someone Sent You Something!!!', $content); // Redirect user to thank you page ************ NOT WORKING ************ header('Location: http://www.yahoo.com'); ?> Link to comment https://forums.phpfreaks.com/topic/158532-solved-redirecting-to-a-new-web-page/ Share on other sites More sharing options...
PFMaBiSmAd Posted May 18, 2009 Share Posted May 18, 2009 Add the following two lines of code immediately after your first opening <?php tag - ini_set("display_errors", "1"); error_reporting(E_ALL); Link to comment https://forums.phpfreaks.com/topic/158532-solved-redirecting-to-a-new-web-page/#findComment-836146 Share on other sites More sharing options...
BobcatM Posted May 18, 2009 Share Posted May 18, 2009 Not sure, just tried your code and it work's fine. Link to comment https://forums.phpfreaks.com/topic/158532-solved-redirecting-to-a-new-web-page/#findComment-836155 Share on other sites More sharing options...
dryan11 Posted May 18, 2009 Author Share Posted May 18, 2009 Add the following two lines of code immediately after your first opening <?php tag - ini_set("display_errors", "1"); error_reporting(E_ALL); Thanks for your quick response! After adding those two lines, I received this error in the web browser. Warning: Cannot modify header information - headers already sent by (output started at /hermes/web10/b871/moo.mytriptical/Test/newmail.php:1) in /hermes/web10/b871/moo.mytriptical/Test/newmail.php on line 23 Any further assistance would be greatly appreciated. Link to comment https://forums.phpfreaks.com/topic/158532-solved-redirecting-to-a-new-web-page/#findComment-836157 Share on other sites More sharing options...
PFMaBiSmAd Posted May 18, 2009 Share Posted May 18, 2009 output started at newmail.php:1 (line 1) You have something before the <?php tag. It is either actual character(s) in the file or the file has been saved as UTF-8 encoding and the BOM (Byte Order Mark) characters that the editor puts at the start of the file is the output being sent. Check there is nothing before the <?php tag in the file and either save the file as ANSI (ASCII) or if you must save it as UTF-8, save it without the BOM. Link to comment https://forums.phpfreaks.com/topic/158532-solved-redirecting-to-a-new-web-page/#findComment-836159 Share on other sites More sharing options...
BK87 Posted May 18, 2009 Share Posted May 18, 2009 all redirection must be genuine... that means NO spaces, text, or anything before the actual code. ex. <html> <?php //your code here header("location: blajh.com"); ?> this will not work because there is text before the redirection! Link to comment https://forums.phpfreaks.com/topic/158532-solved-redirecting-to-a-new-web-page/#findComment-836160 Share on other sites More sharing options...
dryan11 Posted May 18, 2009 Author Share Posted May 18, 2009 output started at newmail.php:1 (line 1) You have something before the <?php tag. It is either actual character(s) in the file or the file has been saved as UTF-8 encoding and the BOM (Byte Order Mark) characters that the editor puts at the start of the file is the output being sent. Check there is nothing before the <?php tag in the file and either save the file as ANSI (ASCII) or if you must save it as UTF-8, save it without the BOM. Thanks! I'm not sure exactly what was causing the issue, but after I read this I rewrote the file just using Notepad and it worked fine. I was using Dreamweaver, so I'm assuming that is saves the file with some extra characters that I didn't want. Thanks again for the help. Was very simple, wish I was able to figure that one out on my own. Link to comment https://forums.phpfreaks.com/topic/158532-solved-redirecting-to-a-new-web-page/#findComment-836168 Share on other sites More sharing options...
BK87 Posted May 18, 2009 Share Posted May 18, 2009 dreamweaver sucks! notepad baby! Link to comment https://forums.phpfreaks.com/topic/158532-solved-redirecting-to-a-new-web-page/#findComment-836169 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.