Guest User

Untitled

a guest
Mar 17th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. <?php
  2. require 'connection.php';
  3. $catAttributes = "SELECT * FROM categoryhasattributes where category_id = '$categoryid'"; //suppose $categoryid=10
  4. $queryCatAttributes = mysqli_query($con,$catAttributes);
  5. $arrayCatAttributes = array();
  6. $index = 0;
  7. while($row = mysqli_fetch_assoc($queryCatAttributes)){
  8. $arrayCatAttributes[$index] = $row;
  9. $index++;
  10. }
  11.  
  12. ?>
  13. <div class="form-group row">
  14. <label class="col-sm-3 form-control-label">Enabled Attributes</label>
  15. <div class="col-sm-9">
  16. <?php
  17.  
  18. $getAttributes = "SELECT * FROM categoryattributes";
  19. $queryAttributes = mysqli_query($con,$getAttributes);
  20. $i = 0;
  21.  
  22. while ($t = mysqli_fetch_array($queryAttributes)) {
  23.  
  24. ?>
  25.  
  26. <div style='position: relative; margin: 5px; width: 40%; float: left;'>
  27. <input type="checkbox"
  28. <?php echo $arrayCatAttributes[$i]['attribute_id'] == $t['id'] ? 'checked' : ''; ?>
  29. value="<?php echo $t['id']; ?>"> <?php echo $t['attr_display']; ?>
  30. </div>
  31. <?php
  32.  
  33. $i++;
  34. }
  35. ?>
  36. </div>
Add Comment
Please, Sign In to add comment