Advertisement
cdsatrian

checkbox v1

Apr 7th, 2014
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.21 KB | None | 0 0
  1. <?php
  2. //..FORM INPUTAN
  3. $sql="SELECT *
  4.      FROM checklist a
  5.      WHERE check_pos LIKE '%Director%'
  6.      AND check_ok<>'Check'";
  7. $result = mysql_query($sql);
  8. if(mysql_num_rows($result)>0)
  9. while($data = mysql_fetch_object($result))
  10. {
  11. ?>
  12. <li>
  13. <div class="form_grid_12">
  14. <label class="field_title" id="actual"><?php echo $data->check_pos; ?></label>
  15. <input type="hidden"
  16.        value="<?php echo $data->check_pos; ?>"
  17.        name="namepos[<?php echo $data->check_id; ?>]" />
  18. <div class="form_input">
  19. <input type="hidden" name="id[]" value="<?php echo $data->check_id; ?>" />
  20. <input class="checkbox"
  21.        type="checkbox"
  22.        value="Check"
  23.        style="opacity: 0;"
  24.        name="position[<?php echo $data->check_id; ?>]" />
  25. </div>
  26. </div>
  27. </li>
  28. <?php } ?>
  29. <input type='hidden' name='code' value='<?php echo $data->check_code; ?>' />
  30.  
  31.  
  32. //..FILE PEMROSES INPUTAN
  33. include 'config.php';
  34. $code = $_POST['code'];
  35. $pos = $_POST['position'];
  36. $name = $_POST['namepos'];
  37. foreach($name as $index => $names)
  38. {
  39. $insert = mysql_query("INSERT INTO checklist (check_pos,check_code,check_ok)
  40.                        VALUES ('$name[$index]','$code','$pos[$index]')")
  41.           or die (mysql_error());
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement