title: PHP Form Search JSON API
body: <p>I'm trying to create a query.php with a query_result.php page for an API JSON feed. I get the return on 10 items at a time but by querying for a "year" I still don't get just that year, example YearBuilt = "1999" I still get returned vessels of all years.</p>
  
  <p>QUERY.PHP</p>
  
  <pre><code>&lt;!DOCTYPE HTML&gt;
  &lt;html&gt;
  &lt;head&gt;
  
      &lt;title&gt;Yacht Search&lt;/title&gt;
      &lt;link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/themes/ui-darkness/jquery-ui.css" rel="stylesheet"&gt;
      &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"&gt;&lt;/script&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  
  
      &lt;form action="http://www.yachts.theskywatergroup.com/yatco_data_feeds/datafeed_customer/query_results.php" target="_blank" method="get"&gt;
  
      Year Built: &lt;input id="YearBuilt" type="text" placeholder="Year Built" name="YearBuilt" value="" size="7" maxlength="4" /&gt;
      &lt;input name="search" type="submit" class="" value="Search Yachts" /&gt;
  
      &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>QUERY_RESULTS.PHP</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
      &lt;title&gt;&lt;/title&gt;
      &lt;link href="http://datafeed.yatco.com/yatco.css" rel="stylesheet" type="text/css" /&gt;
      &lt;meta charset="utf-8"&gt;
  &lt;/head&gt;
   &lt;body&gt;
  &lt;?php
  $apikey = 'XXX';
  $service_url = 'http://data.yatco.com/dataservice/' . $apikey . '/search?pagesize=10&amp;pageindex=0&amp;format=json';
  $curl = curl_init($service_url);
  
  //curl_setopt($curl, CURLOPT_REFERER, 'http://localhost');
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  
  $curl_response = curl_exec($curl);
  
  if ($curl_response === false) {
      $info = curl_getinfo($curl);
      curl_close($curl);
      die('error occured during curl exec. Additioanl info: ' . var_export($info));
  }
  
  curl_close($curl);
  $decoded = json_decode($curl_response);
  if (isset($decoded-&gt;response-&gt;status) &amp;&amp; $decoded-&gt;response-&gt;status == 'ERROR') {
      die('error occured: ' . $decoded-&gt;response-&gt;errormessage);
  }
  
  foreach ($decoded as $name =&gt; $value) {
      if ($name != 'Vessels') {
          echo $name . ' = ' . $value . '&lt;br /&gt;';
      } else {
      foreach ($value as $entry) {
      ?&gt;  
      &lt;table border="0" width="100%" cellspacing="0" cellpadding="0"&gt;
                          &lt;tbody&gt;
                              &lt;tr&gt;
                                  &lt;td style="background-color: #a1a1a1; height: 1px;" colspan="3"&gt;
                                  &lt;/td&gt;
                              &lt;/tr&gt;
                              &lt;tr&gt;
                                  &lt;td class="SearchHeader" colspan="3"&gt;
                                      &lt;span&gt;&lt;?php Echo $entry-&gt;Boatname ?&gt;&lt;/span&gt;&amp;nbsp; &lt;span&gt;&lt;?php Echo $entry-&gt;AskingPriceFormatted?&gt;
                                      &lt;/span&gt;&amp;nbsp; &lt;span&gt;&lt;?php Echo $entry-&gt;ApproxPriceFormatted ?&gt;&lt;/span&gt;&amp;nbsp; (&lt;a href="#"
                                          class="ResultsLink" onclick="viewVessel(&lt;?php Echo $entry-&gt;VesselID ?&gt;);"&gt;View Details&lt;/a&gt;)
                                  &lt;/td&gt;
                              &lt;/tr&gt;
                              &lt;tr&gt;
                                  &lt;td valign="top" align="left" width="200px"&gt;&lt;img src='&lt;?php Echo $entry-&gt;ProfileURL ?&gt;' alt="" title="" style="max-height: 200px;
                                          max-width: 200px;" onclick="viewVessel(&lt;?php Echo $entry-&gt;VesselID ?&gt;);" /&gt;&lt;/td&gt;
                                  &lt;td valign="top" style="padding: 5px 0px 0px 5px;" width="200px"&gt;
                                      &lt;table&gt;
                                          &lt;tr&gt;
                                              &lt;td&gt;
                                                  &lt;span class="SearchLabel"&gt;LOA:&lt;/span&gt;&amp;nbsp; &lt;span class="SearchData"&gt;&lt;?php Echo $entry-&gt;LOAFeet ?&gt;
                                                  &lt;/span&gt;
                                              &lt;/td&gt;
                                          &lt;/tr&gt;
                                          &lt;tr&gt;
                                              &lt;td&gt;
                                                  &lt;span class="SearchLabel"&gt;Model Year:&lt;/span&gt;&amp;nbsp; &lt;span class="SearchData"&gt;&lt;?php Echo $entry-&gt;YearBuilt ?&gt;
                                                  &lt;/span&gt;
                                              &lt;/td&gt;
                                          &lt;/tr&gt;
                                          &lt;tr&gt;
                                              &lt;td&gt;
                                                  &lt;span class="SearchLabel"&gt;Beam:&lt;/span&gt;&amp;nbsp; &lt;span class="SearchData"&gt;&lt;?php Echo $entry-&gt;BeamFeet ?&gt;
                                                  &lt;/span&gt;
                                              &lt;/td&gt;
                                          &lt;/tr&gt;
                                          &lt;tr&gt;
                                              &lt;td&gt;
                                                  &lt;span class="SearchLabel"&gt;Draft:&lt;/span&gt;&amp;nbsp; &lt;span class="SearchData"&gt;&lt;?php Echo $entry-&gt;DraftFeet ?&gt;
                                                  &lt;/span&gt;
                                              &lt;/td&gt;
                                          &lt;/tr&gt;
                                          &lt;tr&gt;
                                              &lt;td&gt;
                                                  &lt;span class="SearchLabel"&gt;Staterooms/Sleeps:&lt;/span&gt;&amp;nbsp; &lt;span class="SearchData"&gt;&lt;?php Echo $entry-&gt;NumStaterooms ?&gt;&lt;/span&gt;/
                                                  &lt;span class="SearchData"&gt;&lt;?php Echo $entry-&gt;NumSleeps ?&gt;&lt;/span&gt;
                                              &lt;/td&gt;
                                          &lt;/tr&gt;
                                          &lt;tr&gt;
                                              &lt;td height="5"&gt;
                                              &lt;/td&gt;
                                          &lt;/tr&gt;
                                      &lt;/table&gt;
                                  &lt;/td&gt;
                                  &lt;td valign="top" style="padding: 5px 0px 0px 5px;"&gt;
                                      &lt;table&gt;
                                          &lt;tr&gt;
                                              &lt;td&gt;
                                                  &lt;span class="SearchLabel"&gt;Builder:&lt;/span&gt;&amp;nbsp; &lt;span class="SearchData"&gt;&lt;?php Echo $entry-&gt;Builder ?&gt;
                                                  &lt;/span&gt;
                                              &lt;/td&gt;
                                          &lt;/tr&gt;
                                          &lt;tr&gt;
                                              &lt;td&gt;
                                                  &lt;span class="SearchLabel"&gt;Model:&lt;/span&gt;&amp;nbsp; &lt;span class="SearchData"&gt;&lt;?php Echo $entry-&gt;Model ?&gt;
                                                  &lt;/span&gt;
                                              &lt;/td&gt;
                                          &lt;/tr&gt;
                                          &lt;tr&gt;
                                              &lt;td&gt;
                                                  &lt;span class="SearchLabel"&gt;Type:&lt;/span&gt;&amp;nbsp; &lt;span class="SearchData"&gt;&lt;?php Echo $entry-&gt;MainCategory ?&gt;
                                                  &lt;/span&gt;&amp;nbsp;
                                              &lt;/td&gt;
                                          &lt;/tr&gt;
                                          &lt;tr&gt;
                                              &lt;td&gt;
                                                  &lt;span class="SearchLabel"&gt;Engine:&lt;/span&gt;&amp;nbsp; &lt;span class="SearchData"&gt;&lt;?php Echo $entry-&gt;EngineInfo ?&gt;
                                                  &lt;/span&gt;
                                              &lt;/td&gt;
                                          &lt;/tr&gt;
                                          &lt;tr&gt;
                                              &lt;td&gt;
                                                  &lt;span class="SearchLabel"&gt;Location:&lt;/span&gt;&amp;nbsp; &lt;span class="SearchData"&gt;&lt;?php Echo $entry-&gt;VesselLocation ?&gt;
                                                  &lt;/span&gt;
                                              &lt;/td&gt;
                                          &lt;/tr&gt;
                                      &lt;/table&gt;
                                  &lt;/td&gt;
                              &lt;/tr&gt;
                          &lt;/tbody&gt;
                      &lt;/table&gt;
      &lt;?php
      }
      }
  }
  
   ?&gt; 
   &lt;/body&gt;
  &lt;/html&gt; 
  </code></pre>