Jump to content

[SOLVED] Redirecting to a new web page


dryan11

Recommended Posts

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

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.

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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.