title: php $_POST select option value not working undefined index error
body: <pre><code>&lt;?php
      $dbhost = 'localhost';
      $dbuser = 'root';
      $dbpass = '';
  
  $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to 
  mysql');
  $dbname = 'vendordb';
  mysql_select_db($dbname);
  ?&gt;
  &lt;html&gt;
  &lt;div class="row"&gt;
      &lt;form id="form1" name="form1" action="&lt;?php $_SERVER['PHP_SELF'];?&gt;" 
          method="post"&gt;
          &lt;?php   
              $result=mysql_query("select crtname from crtinfo");
  
              echo "&lt;select id='criteria1' name='criteria1'" . "&gt;";
  
              while($row = mysql_fetch_array($result))
              {
                  echo "&lt;option value=".$row[0]. "&gt;". $row[0]. "&lt;/option&gt;";
              }
              echo "&lt;/select&gt;";
  
              $crt1=$_POST['criteria1'];
              echo $crt1;  
          ?&gt;
      &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>Unable to get dropdown value in $_POST</p>
  
  <p>Error:</p>
  
  <p>Notice: Undefined index: criteria1 in C:\xampp\htdocs\website\dropdowntest.php on line 25
  cannot get value from $_POST</p>