Javascript alert and php header

php

Solution

Maybe try redirect using JavaScript.

if ( $pkt < 1 OR $user_id == 0) {
    $message = 'This is a message.';

    echo "<SCRIPT> //not showing me this
        alert('$message')
        window.location.replace('url of the page');
    </SCRIPT>";
    mysql_close();
}

Problem

I got a little problem. When I got my PHP script without header it's fine, I am getting javascript alert box. But when I use header before alert it's not working. It's redirecting me like it should, but it's not showing any box. Could someone help me? ``` if ( $pkt < 1 OR $user_id == 0) { header("Location: http://dunno.com/file.php"); $message = 'This is a message.'; echo "<SCRIPT> //not showing me this alert('$message'); </SCRIPT>"; mysql_close(); } ``` And here's the one which work (but without heading) ``` if ( $pkt < 1 OR $user_id == 0) { $message = 'This is a message.'; echo "<SCRIPT> //showing me alert('$message'); </SCRIPT>"; mysql_close(); } ``` I would be thankful for help :) @edit Maybe is there any command to make alert wait until whole browser load? (if it's the problem)

Original source