validate checkboxes using php
<p>I have a form with series of checkboxes with the same name of 'name=category[]'. And now I need to count how many checkboxes are selected by a user. Further I need to check at least 1 checkbox is being selected or upto 10 checkboxes. </p>

<p>This is the way that I am trying so far...</p>

<pre><code>if ( isset ( $_POST['category']) {

  if (( sizeof( $_POST['category']) == 10 || sizeof( $_POST['category']) &lt;= 10 )) {

     // form processing....

  } else {

      echo 'Atleast 1, not more than 10 categories.';
  }

} else {

  echo 'Please select atleast one category.';

}
</code></pre>

<p>can anybody tell me is there an another way to accomplish this task? That mean, to get this two errors... </p>
