mardi 14 février 2017

how to display dynamically created check boxes in category?

i'm creating add product page for admin panel and i'm storing multiple attributes and sub attributes for every product...also that attribute and sub-attributes are inserted by admin so both are random...it can be anything pre stored in database

now main attribute ex is color: sub attribute is blue,orange

now i'm able to create dynamic check box depends on dropbox's onchange event but don't know how to display them in category...

for ex:

size:

large checkbox small checkbox medium checkbox

color:

blue checkbox green checkbox orange checkbox

right now it looks bad: see screenshot so you can get idea of it

it's like::

size:large size:medium size:xl

every time it's printing size(attribute)

my php script for displaying them:

$parent=array($_GET['ids']);
include ('database/connection.php');
$query="SELECT atr.*,sub.* from attributes atr inner join subattributes sub on sub.parent_id=atr.attrib_id Where sub.parent_id IN (".implode(',',$parent).")";
$result=mysqli_query($con,$query);
 while($row=mysqli_fetch_array($result))
 {      echo"<label>".$row['attrib_title'].":</lable>
    <label>
    <input type='checkbox' name='Checkbox[]' value='".$row['subattrib_id']."' id='CheckboxGroup1_0'>".$row['subattrib_title']."<br></label><br/>"; }




Aucun commentaire:

Enregistrer un commentaire