SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Addict Feudalism's Avatar
    Join Date
    Jun 2002
    Location
    Buenos Aires, Argentina
    Posts
    361
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question <?php response.redirect

    what is the PHP function to replace the Asp's response.redirect?

    I have tried with "header" but no response.

  2. #2
    He's No Good To Me Dead silver trophybronze trophy stymiee's Avatar
    Join Date
    Feb 2003
    Location
    Slave I
    Posts
    23,424
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    I don't know ASP but I think you would do:

    header("Location: somepage.php");

  3. #3
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    header('Location: http://www.sitepoint.com'); 
    header in itself does not redirect. with header() you can send any header like
    header('Content-Type: text/html');
    and so on.
    ---------------------------
    Errors = Improved Programming.
    My Site

  4. #4
    SitePoint Addict Feudalism's Avatar
    Join Date
    Jun 2002
    Location
    Buenos Aires, Argentina
    Posts
    361
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    and how can I redirect?

    that function didn't work

  5. #5
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What is the error you get?
    and how are you using it?

    That is how this function will work. You can get more information on this by going to http://ca.php.net/header or http://www.zend.com/manual/function.header.php
    ---------------------------
    Errors = Improved Programming.
    My Site

  6. #6
    Wadge! F4nat1c's Avatar
    Join Date
    Oct 2005
    Location
    South Wales, UK
    Posts
    1,134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do this:

    PHP Code:
    ?><meta http-equiv="REFRESH" content="1;url=www.sitepoint.com"><?
    Basically I closed PHP, put a HTML refresh tag in there, then opened PHP again. This can go anywhere in your PHP code.

    Also I can't see why header() won't work. What trouble are you getting with it?
    OMFG SitePoint ROXORZ TEH BIG ONE111!
    Wish you were invisible?

  7. #7
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    header("Location: [url]") is definitely what you're looking for.
    Last edited by Dan Grossman; May 4, 2006 at 17:36.

  8. #8
    SitePoint Wizard cmuench's Avatar
    Join Date
    Jul 2005
    Location
    At my computer
    Posts
    2,251
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also keep in mind that the header("Location: [url]") has to go before anything is output to the broswer. That also means your XHTML or HTML declaration.

  9. #9
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cmuench
    Also keep in mind that the header("Location: [url]") has to go before anything is output to the broswer. That also means your XHTML or HTML declaration.
    Just adding to the list,

    even a space should not be there
    ---------------------------
    Errors = Improved Programming.
    My Site

  10. #10
    SitePoint Wizard cmuench's Avatar
    Join Date
    Jul 2005
    Location
    At my computer
    Posts
    2,251
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I forgot about the space. I don't know how many times one space shoots out an error which screws up the whole site


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •