title: Making an option in an HTML dropdown menu selected.
body: <p>Thanks for reading my question.</p>
  
  <p>I have a website that uses PHP for a searchable card database. Right now I have the code for the head/searchbox section on each page, but I want to use functions instead. The function itself is working. The problem is with the drop down boxes. I currently have it set up so that when a user selects and option, and then searches, the selections are selected on the next page. </p>
  
  <p>I am sure that I am having a problem with syntax.</p>
  
  <p>Here is an example of the working code, which is <a href="http://lotrlcg.com/searchBox.php?terms=&amp;Type=1&amp;Sphere=1&amp;Expsn=1&amp;Sort=1&amp;Sort_AD=1&amp;Then_Sort=1&amp;Then_Sort_AD=1&amp;radio=All&amp;Scenario=1&amp;Encounter_Set=1" rel="nofollow">used on the live site right now.</a> </p>
  
  <pre><code>    &lt;select name="Type" onchange="this.submit()"&gt;
          &lt;option value="1" &gt;[All Card Types] &lt;/option&gt;
          &lt;option value="Hero" &lt;?php if($_GET['Type'] == "Hero") echo "selected='selected'"; ?&gt;&gt; Hero &lt;/option&gt;
          &lt;option value="Ally" &lt;?php if($_GET['Type'] == "Ally") echo "selected='selected'"; ?&gt;&gt; Ally &lt;/option&gt;
      &lt;/select&gt;
  </code></pre>
  
  <p>This is the relevant code from the function, which is not working, and <a href="http://lotrlcg.com/searchBoxTest.php" rel="nofollow">is on the test site</a> (ignore the error):</p>
  
  <pre><code>function searchBox(){
  //Cell 1
      echo '
          &lt;select name="Type" onchange="this.submit()"&gt;
              &lt;option value="1" &gt;[All Card Types] &lt;/option&gt;
              &lt;option value="Hero"  &lt;?php if($_GET["Type"] == "Hero") { echo "selected=selected" ; }?&gt;&gt;   Hero    &lt;/option&gt;
              &lt;option value="Event" &lt;?php if($_GET["Type"] == "Event") { echo "selected=selected"; }?&gt;&gt;   Event &lt;/option&gt;
          &lt;/select&gt;
      ';
  }
  </code></pre>
  
  <p>As you can see in the test page, the dropdown menu doesn't function like it does on the live page. </p>
  
  <p>Thanks for the help!</p>