title: PHP - Using a drop down list to change site theme
body: <p>I have a drop down list where users can select a theme for the site.  The only problem is, I'm not quite sure how to properly load the theme once they press "Apply".  I am new to PHP.  I know if I use GET, it will pass the variables through a the current page and add them to the end of the URL.  I would really like to avoid that. So, I guess my question is, how can I avoid using GET to update the theme? Thank you.</p>
  
  <p>Here is my code to load the correct theme:</p>
  
  <pre><code>&lt;?php
  $stylesArr = array('Default', 'Black', 'Pink', 'Green', 'Red');
  if(isset($_GET['theme']) &amp;&amp; in_array($_GET['theme'], $stylesArr)) {
      $style = $_GET['theme'];
      setcookie("theme", $style, time()+(60*60*24*30));
  } else {
      if(isset($_COOKIE['theme']) &amp;&amp; in_array($_COOKIE['theme'], $stylesArr)) {
          $style = 'CSS/' . $_COOKIE['theme'] . '.css';
      } else {
          $style = 'CSS/Default.css';
      }
  }
  ?&gt;
  </code></pre>
  
  <p>Here is my drop down list to select the theme:</p>
  
  <pre><code>&lt;form action="&lt;?php echo $_SERVER["PHP_SELF"] ?&gt;" method="post"&gt;
  &lt;p&gt;Site Theme:
  &lt;select name="theme"&gt;
  &lt;option value="Default"&gt;Default&lt;/option&gt;
  &lt;option value="Black"&gt;Black&lt;/option&gt;
  &lt;option value="Pink"&gt;Pink&lt;/option&gt;
  &lt;option value="Green"&gt;Green&lt;/option&gt;
  &lt;option value="Red"&gt;Red&lt;/option&gt;
  &lt;/select&gt;
  &lt;input type="submit" value="Apply" /&gt;
  &lt;/form&gt;
  </code></pre>