phpmeta-tags

using "header Refresh" (PHP) + "meta refresh" (HTML) together


I need to use "header Refresh" (PHP) + "meta refresh" (HTML) together, the PHP refresh is working, but the meta one is ignored, please help me, thanks

<? $idne2=$_GET['idne']; ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Chat With <?="$idne2";?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="refresh" content="5; URL=http://example.net">
</head>
<body>
<?
echo "You're being redirected to... page";
header("Refresh: 2; URL=ymsgr:sendIM?$idne2");
?>
</body>
</html>

Solution

  • header function will not work if there is any html output before header function.

    use JS redirect.

     <? $idne2=$_GET['idne']; ?>
     <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>Chat With <?="$idne2";?></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body>
    <?php
    echo "You're being redirected to... page";
    sleep(2);
    echo ("<SCRIPT LANGUAGE='JavaScript'>
         window.location.href='ymsgr:sendIM?$idne2';
         window.location.href='http://example.net';
         </SCRIPT>");
    ?>
    </body>
    </html>