Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.