Need help making a script redirect when done

Discussion in 'PHP' started by DerkThunder, Nov 2, 2007.

  1. #1
    I have a simple php script I want to use to have visitors on my site flag links as being expired or having incorrect content. It's set so that when a visitor clicks the flag link it sends an e-mail to me telling me that the link has been flagged.

    The script works fine and the e-mail shows up, the only problem is that the user is directed to a blank page and I want them to go to a page of my choice. Could someone please help me?

    Here is what I have for the script

     
    DerkThunder, Nov 2, 2007 IP
  2. exodus

    exodus Well-Known Member

    Messages:
    1,900
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    165
    #2
    Personally I would use a header redirect after doing my php work, but a meta refresh will work too.

     echo '<meta http-equiv="refresh" content="0;url=http://site.com">'; exit;
    PHP:
    Some servers do not allow the php header redirect. That is when you use the meta refresh redirect instead.
     
    exodus, Nov 2, 2007 IP
  3. bartolay13

    bartolay13 Active Member

    Messages:
    735
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    98
    #3
    if you are using user-defined functions you can try this..

    function redirect($time,$topage)
    {
    echo "<meta http-equiv=\"refresh\" content=\"{$time}; url={$topage}\" /> ";
    }

    then call the function to the script;

    redirect(2,"yourUrl.php");
     
    bartolay13, Nov 3, 2007 IP