1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to forward to another page using PHP

Discussion in 'PHP' started by kks_krishna, May 14, 2007.

  1. #1
    HI ,

    I am using
    header("Location: http://www.domian.com/url.php");

    for forwarding to another page. But I am getting the following error:
    Warning: Cannot modify header information - headers already sent by (output started at /home/content/k/k/s/kkskrishna/html/dlinks/users/login.php:4) in

    how can i solve this?
     
    kks_krishna, May 14, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    http://www.php.net/header
     
    nico_swd, May 14, 2007 IP
  3. stanlogin

    stanlogin Active Member

    Messages:
    97
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #3
    nothing could be print before header(), even a space
     
    stanlogin, May 14, 2007 IP
  4. e39m5

    e39m5 Peon

    Messages:
    44
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    As alternative you echo this:
    
    <META HTTP-EQUIV="refresh" content="0;URL=http://www.url.com/">
    
    PHP:
    However, this genreally results in page flickering before it moves on to the next page.

    e39m5
     
    e39m5, May 14, 2007 IP
  5. Subikar

    Subikar Active Member

    Messages:
    241
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #5
    <META HTTP-EQUIV="refresh" content="0"URL="http://www.url.com/"> This is the correct code.


    In php header("Location: http://www.domian.com/url.php"); After this use exit; I hope this will solve your problem
     
    Subikar, May 14, 2007 IP
  6. coderbari

    coderbari Well-Known Member

    Messages:
    3,168
    Likes Received:
    193
    Best Answers:
    0
    Trophy Points:
    135
    #6
    you are facing this error bcoz you might use any echo before the header();
     
    coderbari, May 14, 2007 IP
  7. gibex

    gibex Active Member

    Messages:
    1,060
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    95
    #7
    header must be called before session_start()
     
    gibex, May 15, 2007 IP
  8. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #8
    ^^ That's not true. You can send headers after starting the session.
     
    nico_swd, May 15, 2007 IP
  9. hclhost.com

    hclhost.com Banned

    Messages:
    257
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #9
    <META HTTP-EQUIV="refresh" content="0"URL="http://www.yoursitename.com/">

    write this after the <head> and change the URL to your desired URL ,
     
    hclhost.com, May 15, 2007 IP