title: how to display the selected value from combo box in php
body: <p>I have  select (combo boxes) in PHP and after one was selected i fill the second one with data from the database.
  the question is how to display my selection from the first combo box after the page reload.
  I have the following code:</p>
  
  <pre><code>    &lt;select name="category" id="category" maxlength="30" onchange="this.form.submit();"&gt;
                                  &lt;option value =""&gt;&lt;/option&gt;
                              &lt;?php
                                  require_once("config.php");
                                  // Connect to server
                                  $con = mysql_connect($ServerAddress,$ServerUser,$ServerPassword);
                                  //choose DB
                                  mysql_select_db($DbName, $con);                             
                                  $sql = "SELECT * FROM `category` ORDER BY `name`";
                                  $res = mysql_query($sql);
                                  while ($row1 = mysql_fetch_array($res)){
                                      echo '&lt;option value ="'.$row1['name'].'"&gt;'.$row1['name'].'&lt;/option&gt;';
  
                                  }       
                              ?&gt;
                              &lt;/select&gt;
                          &lt;/span&gt;
  &lt;label&gt;race:&lt;/label&gt;
  &lt;span&gt;
                              &lt;select name="race" id="race" maxlength="30" &gt;
                                  &lt;option value =""&gt;&lt;/option&gt;
                              &lt;?php
                                  if (isset($_POST['category'])) {
                                      $var = $_POST['category'];
  
                                      // Connect to server
                                      $con = mysql_connect($ServerAddress,$ServerUser,$ServerPassword);
                                      //choose DB
                                      mysql_select_db($DbName, $con);     
                                      $sql = "SELECT * FROM `race` WHERE `category`='" . sqlSecure($var) . "'ORDER BY `race`";                                
                                      $res = mysql_query($sql);
                                      while ($row1 = mysql_fetch_array($res)){
                                          echo '&lt;option value ="'.$row1['race'].'"&gt;'.$row1['race'].'&lt;/option&gt;';
                                      }   
                                  }
                              ?&gt;
                              &lt;/select&gt;
  </code></pre>