Advertisement
Guest User

checkbox code php

a guest
Mar 23rd, 2012
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. ////Code for obtaining and displaying Checkbox list
  2. <div id="exxx">
  3. <fieldset><legend>Select Export Fields</legend>
  4. <?php
  5. $result=mysql_query("desc student_test",$conn);
  6. echo '<ul id="unshund">';
  7. while($row=mysql_fetch_array($result))
  8. {
  9. $val=$row['Field'];
  10. ?>
  11. <script language="JavaScript">
  12. $(function(){
  13. $("#chkAll").change(function(){
  14. if (this.checked == true) {
  15. $("input:checkbox.child").attr("checked", "checked");
  16. }
  17. else {
  18. $("input:checkbox.child").removeAttr("checked");
  19. }
  20. });
  21. });
  22. </script>
  23.  
  24. <li ><input type='checkbox' class="child" name='' id=<?php echo $val; ?> value=<?php echo $val; ?> onchange="javascript:selectedField(this.id)" <?php if(isset($_SESSION['selectedFields'][$val])) { echo 'checked="checked"';} ?> /> <?php echo ucfirst($row['Field']);?> </li>
  25. <?php
  26. }
  27. echo '</ul>';
  28. ?>
  29. <input type="checkbox" id="chkAll" /> Toggle All<br/>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement