title: Display Search Results in Modal Dialog/Box
body: <p>I can't seem to get my modal box to display the results of a search, I can submit the form and the modal box will appear, I've tried echoing my variables in the modal box but nothing shows. I've tried putting the Search script, and script in the modal box. Nothing. I've tried it with almost every Modal box I could find, so it's not the modal boxes I'm just not doing something right. I just know I'm tired, my eyes hurt, and I'm just about to give up doing this. I just don't want the page to refresh when searching, because it clears all the values the user in puts to search for a model id. In order to create a creature, you must have the model ID which aren't easy to find I'm trying to provide my copy of the model ids to be searched through. Please. Any help is appreciated, thanks.  </p>
  
  <p><strong>THE FORM</strong></p>
  
  <pre><code>// My form
      &lt;form name="Form2" method="get" action="" enctype="application/x-www-form-urlencoded" id="Form2"&gt;
      &lt;input type="text" id="Editbox19" style="position:absolute;left:20px;top:80px;width:191px;height:35px;line-height:35px;z-index:0;" name="name" value="" class"rounded"&gt;
      &lt;div id="wb_Text25" style="position:absolute;left:20px;top:134px;width:58px;height:34px;z-index:1;text-align:left;"&gt;
      &lt;span style="color:#FFFFFF;font-family:Arial;font-size:15px;"&gt;Entry ID:&lt;/span&gt;&lt;/div&gt;
      &lt;input type="text" id="Editbox20" style="position:absolute;left:20px;top:153px;width:191px;height:35px;line-height:35px;z-index:2;" name="entry" value=""class"rounded"&gt;
      &lt;div id="wb_Image2" style="position:absolute;left:10px;top:5px;width:221px;height:31px;z-index:3;"&gt;
      &lt;img src="images/modelid.png" id="Image2" alt=""&gt;&lt;/div&gt;
      &lt;div id="wb_Text24" style="position:absolute;left:18px;top:46px;width:227px;height:34px;z-index:4;text-align:left;"&gt;
      &lt;span style="color:#FFFFFF;font-family:Arial;font-size:15px;"&gt;&lt;br&gt; Name:&lt;/span&gt;&lt;/div&gt;
  
      &lt;input type="submit" id="Button1" onclick="$('#jQueryDialog1').dialog('open');return false;" name="" value="Submit" style="position:absolute;left:269px;top:187px;width:96px;height:25px;z-index:2;"&gt;// What activates the Modal Box
  
      &lt;/form&gt;
  </code></pre>
  
  <p><strong>The Modal Box</strong></p>
  
  <pre><code>//Modal Box itself
  &lt;div id="jQueryDialog1" style="z-index:3;" title="This is the title"&gt;
  //Modal Box Content where I want to display Search results.
  &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>My Script:</strong></p>
  
  <pre><code> // Modal Box Script
      &lt;script&gt;
      $(document).ready(function()
      {
         var jQueryDialog1Opts =
         {
            width: 554,
            height: 367,
            position: { my: 'center', at: 'center', of: window },
            resizable: true,
            draggable: true,
            closeOnEscape: true,
            autoOpen: false
         };
         $("#jQueryDialog1").dialog(jQueryDialog1Opts);
      });
      &lt;/script&gt;
  </code></pre>
  
  <p><strong>My Search Script:</strong> </p>
  
  <pre><code>  &lt;?php 
          if(isset($_GET['name'], $_GET['entry'])) {
          try { 
  
          $host = "xxxxxx";
          $user = "xxxxxxxx";
          $password = "xxxxxx";
          $database_name = "xxxxxxxx";
          $dbh = new PDO("mysql:host=$host;dbname=$database_name", $user, $password, array(
          //PDO::ATTR_ERRMODE =&gt; PDO::ERRMODE_EXCEPTION
          ));
  
          $conditions = array();
          $oemSearch = $_GET['name'];
          $oempnSearch = $_GET['entry'];
          $min = 1;
          $oemLen = strlen($oemSearch);
          $oempnLen = strlen($oempnSearch);
  
          if ($oemSearch == "" &amp;&amp; $oempnSearch == "") {
           echo "You must enter a Name or Entry ID";
           exit;
          }
           if ($oemSearch != "" &amp;&amp; $oemLen &lt; $min) { 
           echo "You must enter an Entry ID of atleast 1 Character.";
           exit;
          }
           if ($oempnSearch != "" &amp;&amp; $oempnLen &lt; $min) { 
           echo "You must enter at least 3 P/N characters.";
           exit;
          }
          if ($oemSearch != "" &amp;&amp; $oempnSearch == "") {
          $stmt = $dbh-&gt;prepare("select * from creature_template WHERE name LIKE '%$oemSearch%' ORDER BY entry LIMIT :limit OFFSET :offset");
          //$query-&gt;bindValue(1, "%$oemSearch%", PDO::PARAM_STR);
          }
          if ($oemSearch == "" &amp;&amp; $oempnSearch != "") {
          $stmt = $dbh-&gt;prepare("select * from creature_template WHERE name LIKE '%$oempnSearch%' ORDER BY entry LIMIT :limit OFFSET :offset");
          //$query-&gt;bindValue(1, "%$oemSearch%", PDO::PARAM_STR);
          }
          if ($oemSearch != "" &amp;&amp; $oempnSearch != "") {
          $stmt = $dbh-&gt;prepare("select * from creature_template WHERE name LIKE '%$oemSearch%' OR entry LIKE '%$oempnSearch%' ORDER BY entry LIMIT :limit OFFSET :offset");
          //$query-&gt;bindValue(1, "%$oemSearch%", PDO::PARAM_STR);
          }
  
          // Find out how many items are in the table
          $total = $dbh-&gt;query("SELECT COUNT(*) AS num FROM creature_template ")-&gt;fetchColumn();
  
          // How many items to list per page
          $limit = 10;
  
          // How many pages will there be
          $pages = ceil($total / $limit);
  
          // What page are we currently on?
          $page = min($pages, filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT, array(
              'options' =&gt; array(
              'default'   =&gt; 1,
              'min_range' =&gt; 1,
              ),
          )));
  
          // Calculate the offset for the query
          $offset = ($page - 1) * $limit;
  
          // Some information to display to the user
          $start = $offset + 1;
          $end = min(($offset + $limit), $total);
  
          // Bind the query params
          $stmt-&gt;bindParam(':limit', $limit, PDO::PARAM_INT);
          $stmt-&gt;bindParam(':offset', $offset, PDO::PARAM_INT);
          $stmt-&gt;execute();
  
          // Do we have any results?
          if ($stmt-&gt;rowCount() &gt; 0) {
              // Define how we want to fetch the results
              $stmt-&gt;setFetchMode(PDO::FETCH_ASSOC);
              $iterator = new IteratorIterator($stmt);
  
             // Display the results
          echo "&lt;table class='views-table' border=1&gt;";   
                echo "&lt;tr class='tblheader'&gt;&lt;th bgcolor=#00CC00&gt;Name&lt;/th&gt;&lt;th bgcolor=#00CC00&gt;Entry ID&lt;/th&gt;&lt;th bgcolor=#00CC00&gt;Model ID&lt;/th&gt;&lt;/tr&gt;";
              foreach ($iterator as $row) {
                echo "&lt;tr class=odd views-row-first1&gt;&lt;td&gt;&lt;a href=http://wowhead.com/npc=";         
                  echo $row['entry'];
                  echo "&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;";
                  echo $row['entry'];
                  echo "&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;";
                  echo $row['modelid1'];
                  echo "&lt;/td&gt;&lt;/tr&gt;&lt;/b&gt;";
              }
               echo "&lt;/table&gt;"; 
  
  
          } else {
              echo '&lt;p&gt;No results could be displayed.&lt;/p&gt;';
          }
  
          } catch (Exception $e) {
              echo '&lt;p&gt;', $e-&gt;getMessage(), '&lt;/p&gt;';
          }}
          ?&gt;
  </code></pre>