I have a problem with some PHP / JavaScript. I know a bit PHP but new to Javascript. I'm trying to get the JavaScript alertify to work with php.
My Q's: 1: How can I parse a PHP variable to a Javascript alertify function
2: It need to be a if php statement, because
if ($id==1){*show alertify};
elseif($id==2){*Do nothing*};
3: And when back to PHP again.
4: What function do I need to call to get the alertify on page load?
The logic:

Please examples in JavaScript because i'm totally new :)
My code so far:
 <?php include_once "config.php"; 
if(!isset($_SESSION['idUserType'])){
$sql = mysql_query("SELECT * FROM Test WHERE id = $id"); 
while($row = mysql_fetch_array($sql )){
$idStatus = $row["idStatus"];
    if($idStatus==1){
    echo '<BODY onLoad="confirm()">';
    echo '<script>window.onload = confirm();</script>';
    ;} 
    elseif($idStatus==2){
    $sqlsearchoutput .= 'Do nothing'
    ;}
    }}?>
JavaScript code:
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="jscss/alertify.min.js"></script>
<script>
        function reset () {
            $("#toggleCSS").attr("href", "jscss/alertify.default.css");
            alertify.set({
                labels : {
                    ok     : "ok",
                    cancel : "cancel"
                },
                delay : 5000,
                buttonReverse : false,
                buttonFocus   : "ok"
            });
        }
        // Standard Dialogs
        $("#confirm").on( 'click', function () {
            reset();
            alertify.confirm("Comfirm", function (e) {
                if (e) {
                    alertify.success("You clicked: Cancel");
                } else {
                    alertify.error("You clicked: OK");
                }
            });
            return false;
        });
    </script>
 
     
    