Using my SQL Select, I got each of my table rows to display correctly in my html table tag as you can see in the images. However when I click my modal tag in every row it only echos the first row in the whole table, in this case "cat1_tagname CHIROPRACTIC". Not sure why it does not echo based on the for each, looking for a solution.
I tried to add my foreach: <?php foreach($lstTagMain as $rowTagOne) { ?>
inside the modal tag, but it displays every single one upon click.
<?php foreach($lstTagMain as $rowTagOne) { ?>
<tr class="text-center">
<td class="col-md-1">
<a href="category-coupon-list.php?c=1&c1=<?php echo($rowTagOne['product_cat1id']); ?>&c2=0&c3=0&t1=<?php echo($rowTagOne['cat1_tagname']); ?>&t2=0&t3=0"><img src="img/icon-add.png"></a>
</td>
<td class="col-md-1">
<img src="img/icon-edit.png" data-toggle="modal" data-target="#category-edit-one">
<div id="category-edit-one" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content address-modal">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title text-center"><?php echo($rowTagOne['cat1_tagname']); ?></h4>
</div>
<div class="modal-body">
<form method="post" enctype="multipart/form-data">
<div class="row">
<div class="col-md-12">
<input type="text" class="form-control" value="<?php echo($rowTagOne['cat1_tagname']); ?>" name="cat1_tagname" placeholder="Edit Category 1 Name">
</div>
<div class="col-md-12"><hr></div>
<div class="col-md-12">
<select class="form-control" name="producttagid" autocomplete="off" required>
<?php foreach ($lstTag as $rowTag) { ?>
<option class="strong" value="<?php echo $rowTag['producttagid']; ?>"><?php echo $rowTag['tagname']; ?></option>
<?php } ?>
</select>
</div>
<div class="col-md-12"><hr></div>
<div class="col-md-12">
<input type="submit" class="btn button-color-blue font-color-white full_width" name="add_category1" value="ADD">
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</td>
</tr>
<?php } ?>
问题是你的标记添加和你的每个像<div class="modal-diaogue" I'd="<?php echo($rowTagOne['product_cat1id']); ?>">
然后在你的模态上按钮添加类似<a href="#<?php echo($rowTagOne['product_cat1id']); ?>" open modal</a>
的想法是让每个模态都是独一无二的,这样你在打开它时就可以唯一地引用它
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.