title: how do i add validation on drop down select menu?
body: <p>how do i add validation on drop down select menu i have code and i'm working on but problem is that is not working nothing display error message. I want to be display error message if drop down selection values shouldn't be selected before click on add to cart button?</p>
  
  <pre><code>if(isset($_REQUEST['check'])){
  if (isset($_POST['size']) &amp;&amp; $_POST['size'] == '' ) {
  echo 'Error, select category';
  exit;
  }}
  
  &lt;form action="" id="size1" name="size1" method="post"&gt; 
  &lt;select style="background-color:#CCC" 
  name="size" id="size"  onchange="this.form.submit();" &gt;
  &lt;option value=""&gt;Select&lt;/option&gt;
  &lt;option &lt;?php if ($_POST['size'] == 'Small') 
  print 'selected '; ?&gt;  value="Small"&gt;Small&lt;/option&gt;
  &lt;option &lt;?php if ($_POST['size'] == 'Medium') 
  print 'selected '; ?&gt; value="Medium"&gt;Medium&lt;/option&gt;
  &lt;option  &lt;?php if ($_POST['size'] == 'Large') 
  print 'selected '; ?&gt; value="Large"&gt;Large&lt;/option&gt;
  &lt;option   &lt;?php if ($_POST['size'] == 'XL')
  print 'selected '; ?&gt; value="XL"&gt;XL&lt;/option&gt;
  &lt;/select&gt;
  
  &lt;input type="button" class="button1" name="check" 
  value="Add To Cart" onclick="addtocart(&lt;?php echo $row3['id'];?&gt;);" /&gt;
  &lt;/form
  </code></pre>