Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2014
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. //Here the user sets which table fields will be used:
  2. <input type="checkbox" name="id" value="1"> ID
  3. <input type="checkbox" name="name" value="1"> name
  4. <input type="checkbox" name="email" value="1"> email
  5.  
  6. //Here I see what fields the user wants to use and set a variable to 1
  7.  
  8. <?php
  9.  
  10. if (isset($_POST['id']) && $_POST['id'] == "1") {
  11.  
  12. $form_id='1';
  13. }
  14.  
  15. //etc etc
  16.  
  17. $sql = mysql_query("select * from mytable");
  18.  
  19. $sql = mysql_query("select id, name from $table");
  20.  
  21. $fields = [];
  22. if(isset($_POST['id']) && $_POST['id'] == 1) {
  23. $fields[] = 'id';
  24. }
  25.  
  26. $fields = implode(', ', $fields);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement