Populate Dropdown Boxes While Also Populating Table
I have a table that is populated using a foreach loop. One of my columns is SKU Group, which is a column of dropdown boxes. However, whenever the foreach loop runs, only the one co
Solution 1:
first need to populate your dropdown list using loop
<?php$i = 0;
$content = '';
$names = array('Test1','Test2');
foreach ($namesas$row) {
if($i== 0){
$names = array('Test1','Test2');// replace it echo $row ['SKU Group'];foreach($namesas$key)
{
$content .= '<option value="'.$key.'">'.$key.'</option>';
}
}
$i++;
?><tr><td>sadasdsa</td><tdclass="sku_group"id="sku_group-<?phpecho intval ($row['SKU Group'])?>"align="center"><selectid="sku_group_dropdown"><?phpecho$content?></select></td><td><inputtype="button"class="edit"name="edit"value="Edit"></td></tr><?php } ?>
in this code replace your array data or if you want to populate dropdown data outside your loop then first get your group data for you can use this code
Post a Comment for "Populate Dropdown Boxes While Also Populating Table"