Posted By

lfatr on 02/16/10


Tagged

checkboxes unticked


Versions (?)

GET UNTICKED CHECKBOXES


 / Published in: PHP
 

  1. <?php
  2. #test.php
  3.  
  4. if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['mailinglist']){
  5.  
  6. foreach($_POST['mailinglistPre'] as $mailinglistPre) {
  7. $key = in_array($mailinglistPre, $_POST['mailinglist']);
  8. $key = ($key) ? '1' : '0';
  9. echo $key;
  10.  
  11.  
  12. }
  13.  
  14. }
  15. ?>
  16.  
  17. <form id="form-body" action="test.php" method="POST">
  18. 3<input type='checkbox' name='mailinglist[]' value='mailinglists/3.obj' /><br/>
  19. <input type='hidden' name='mailinglistPre[]' value='mailinglists/3.obj' />
  20. 4<input type='checkbox' name='mailinglist[]' value='mailinglists/4.obj' /><br/>
  21. <input type='hidden' name='mailinglistPre[]' value='mailinglists/4.obj' />
  22. 5<input type='checkbox' name='mailinglist[]' value='mailinglists/5.obj' /><br/>
  23. <input type='hidden' name='mailinglistPre[]' value='mailinglists/5.obj' />
  24. <div class="form-surround-notext">
  25. <div><input type="submit" value="Unsubscribe" id="submit" /></div>
  26. </div>
  27. </form>

Report this snippet  

You need to login to post a comment.