title: string matching in php, sometimes it works, sometimes not, what am I missing?
body: <p>So I have a search form, and when the search result page loads, there are some jump menu's at the top to allow a user to narrow down the results.</p>
  
  <p>The jump menu's show the selected search criteria from the posted form.</p>
  
  <p>However, in the 'Ports' jump menu, if you choose Bristol or Edinburgh, when you land on the results page, the ports menu doesn't show them as selected. It does for all the others...</p>
  
  <p>Here's my search select code from the cruise search box</p>
  
  <pre><code>&lt;select name="port" id="port"&gt;
  &lt;option selected value="%"&gt;All Ports...&lt;/option&gt;
  &lt;option value="Bristol Avonmouth"&gt;Bristol Avonmouth&lt;/option&gt;
  &lt;option value="Edinburgh Leith"&gt;Edinburgh Leith&lt;/option&gt;
  &lt;option value="Glasgow Greenock"&gt;Greenock&lt;/option&gt;
  &lt;option value="Hull"&gt;Hull&lt;/option&gt;
  &lt;option value="Liverpool"&gt;Liverpool&lt;/option&gt;
  &lt;option value="London, Tilbury"&gt;London Tilbury&lt;/option&gt;
  &lt;option value="Newcastle"&gt;Newcastle&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>and here's the jump menu code on the results page</p>
  
  <pre><code>&lt;div id="cac"&gt;
      &lt;h3&gt;Sailing from...&lt;/h3&gt;
      &lt;p&gt;&amp;nbsp;&lt;/p&gt;
      &lt;p&gt;
      &lt;select name="jumpMenu3" id="jumpMenu3" onchange="MM_jumpMenu('parent',this,0)"&gt;
      &lt;option value=""&gt;Select a port&lt;/option&gt;
      &lt;?php
      $ports = array(); 
      mysql_data_seek($cruises, 0);
      while ($row_cruises = mysql_fetch_assoc($cruises)) { 
      if (!in_array($row_cruises['fromport'], $ports)) {
          $ports[] = $row_cruises['fromport'];
      ?&gt;
      &lt;option value="index.php?subj=2&amp;destination=&lt;?php echo urlencode($row_cruises['destination']);?&gt;&amp;departs=&lt;?php echo date('Ym',strtotime($row_cruises['departs']));?&gt;&amp;port=&lt;?php echo urlencode($row_cruises['fromport']);?&gt;"&lt;?php if ($_GET['port'] == $row_cruises['fromport'] OR $_POST['port'] == $row_cruises['fromport']) {echo "selected=\"selected\"";}?&gt;&gt;&lt;?php echo $row_cruises['fromport']; ?&gt;&lt;/option&gt;
      &lt;?php } ;
      }
      if(mysql_num_rows($cruises) &gt; 0) {
          mysql_data_seek($cruises, 0);
          $row_cruises = mysql_fetch_assoc($cruises);
      }
      ?&gt;
      &lt;/select&gt;
  </code></pre>
  
  <p>I've checked the ports themselves in the database for spelling, case, spacing... all good.</p>
  
  <p>Maybe I need a like or wildcard comparison operator ? </p>
  
  <p>doh doh doh</p>
  
  <p>Fixed it - the port look up isn't against the ports table, it's against what written for the departure port in the cruises table, and there are some cruises that are entered wrong...</p>
  
  <p>Rich :)</p>