Posted By

ryarwood on 10/07/11


Tagged

forms checkbox process


Versions (?)

Checkbox Processing


 / Published in: PHP
 

  1. // FORM:
  2. // <input type="checkbox" class="community" name="community[]" value="Lakewood Court Townhomes" id="i-lake" />
  3. // <input type="checkbox" class="community" name="community[]" value="Belmont Court Condominiums" id="i-belm" />
  4.  
  5. // PROCESSING PAGE:
  6. $checkboxarray = $_POST[ 'community' ];
  7. for ( $i = 0; $i <= count($checkboxarray); $i++ ) {
  8. $checkboxvar .= $checkboxarray[$i];
  9. if ( $i < (count($checkboxarray) - 1) ) {
  10. $checkboxvar .= ', ';
  11. }
  12. }
  13. echo $checkboxvar; // this is your var dummy

Report this snippet  

You need to login to post a comment.