so i have a form, when user click the button 1st javascript runs, than php runs. so if user hit submit button a window pop ups which is created in javascript.

problem is that i only want to pop up window if it goes in here

else{ //***********pop up window here*****************************}

otherwise dont create pop up window.

index.php

<?php
if(isset($_POST['button'])) 
{
    //check for error
    if(empty($_POST['color'])) 
    {
    }
    else
    {
        //no error
        //***********pop up window here*****************************
          echo"
          <div id='dialog01' title='Shipping Time'>
            random text
          </div>";
    }
}
?>
<form method='POST' action='index.php'>
<input type='file' name='color'>
<button type='submit' id='opener01' name='button'>submit</button>
</form>

jquery.js

    $.fx.speeds._default = 500;
    $( "#dialog01" ).dialog({
        autoOpen: false,   //don't auto open
        show: "blind",    //how to open window
        hide: "explode",  //how to exit window
        width: 400,
        resizable: false,
        modal: true,
        buttons: {
            Cancel: function() {
                $( this ).dialog( "close" );
             }
        }
    });

    $( "#opener01" ).click(function() {
          $( "#dialog01" ).dialog( "open" );
          return false;
    });

any idea's? i really want to do error testing in php and not in js.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.