1,105,226 Community Members

pop up window

Member Avatar
hwoarang69
Posting Pro
572 posts since Feb 2012
Reputation Points: -4 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 9 [?]
 
0
 

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.

LastMitch
Deleted Member
 
0
 

@hwoarang69

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

Try to used JQUERY examples (just take the code apart and used whatever code you need and add it your own code) :

http://blog.theonlytutorials.com/a-very-simple-jquery-popup-ready-to-use-code/

http://www.queness.com/post/77/simple-jquery-modal-window-tutorial

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article