Jump to content

header() code use problem


CPP_code

Recommended Posts

Hello all,

 

I get the following error when executing the following code. Does anyone have any ideas:

 

Warning: Cannot modify header information - headers already sent by (output started at /home/cprath7074k/PHP/do_redirect.php:2) in /home/cprath7074k/PHP/do_redirect.php on line 3

 

"index.html file"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>

<HEAD>

<TITLE> Redirection Menu </TITLE>

</HEAD>

<BODY>

 

<FORM method="POST" action="do_redirect.php">

<br>I want to go to:   

        <SELECT name="url" size="1">

                <OPTION value="http://www.cnn.com/">CNN</OPTION>

                <OPTION value="http://espn.cnn.com/">ESPN</OPTION>

                <OPTION value="http://www.9news.com/">9News</OPTION>

                <OPTION value="http://www.denverpost.com/">Denver Post</OPTION>

        </SELECT>

        <INPUT type="submit" value="Go!">

 

</FORM>

</BODY>

</HTML>

 

"do_redirect.php file"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<?php

header("location:$_POST");

?>

<HTML>

<BODY>

</BODY>

</HTML>

Link to comment
https://forums.phpfreaks.com/topic/196881-header-code-use-problem/
Share on other sites

The doctype is HTML. It is in fact the daddy html tag that tells what kind of html the page contains.

 

It's also not a comment <!--    --> and if it was, that is a HTML comment, which is html, which is something that is output to the browser.

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.