Posted By

aludwig on 07/29/11


Tagged

checkbox


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;

Report this snippet  

You need to login to post a comment.