Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require 'connection.php';
- $catAttributes = "SELECT * FROM categoryhasattributes where category_id = '$categoryid'"; //suppose $categoryid=10
- $queryCatAttributes = mysqli_query($con,$catAttributes);
- $arrayCatAttributes = array();
- $index = 0;
- while($row = mysqli_fetch_assoc($queryCatAttributes)){
- $arrayCatAttributes[$index] = $row;
- $index++;
- }
- ?>
- <div class="form-group row">
- <label class="col-sm-3 form-control-label">Enabled Attributes</label>
- <div class="col-sm-9">
- <?php
- $getAttributes = "SELECT * FROM categoryattributes";
- $queryAttributes = mysqli_query($con,$getAttributes);
- $i = 0;
- while ($t = mysqli_fetch_array($queryAttributes)) {
- ?>
- <div style='position: relative; margin: 5px; width: 40%; float: left;'>
- <input type="checkbox"
- <?php echo $arrayCatAttributes[$i]['attribute_id'] == $t['id'] ? 'checked' : ''; ?>
- value="<?php echo $t['id']; ?>"> <?php echo $t['attr_display']; ?>
- </div>
- <?php
- $i++;
- }
- ?>
- </div>
Add Comment
Please, Sign In to add comment