Skip to content Skip to sidebar Skip to footer

Load Foreach Table In A Modal Which Is Called From Another Foreach Table

i have a modal with a table in in. i load the modal from a foreach table. i believe my code is right but i dont know why it displays in a funny way. this is my code and when i run

Solution 1:

Use like this.

<tableclass="table"><thead><tr><th>#</th><th>Track Number</th><th>Price</th><th>Address</th><th>Order Date</th><th>Status</th><th>Auction</th></tr></thead><tbody><?php$count = 1; 
        $notarray = DataDB::getInstance()->select_from_where('order_collective','user_id',$userid);
        foreach($notarrayas$row):
        $address = $row['appartment'].",".$row['address'].",".$row['city'].",".$row['state'].".".$row['landmark'];
        ?><tr><td><?phpecho$count++;?></td><td><?phpecho$row['trackingnumber'];?></td><td><?phpecho"NGN ".number_format($row['price'], 2);?></td><td><?phpecho$address;?></td><td><?phpecho$row['order_date'];?></td><td><?phpecho DataDB::getInstance()->get_name_from_id('name','delivery_status','delivery_status_id',$row['delivery_status']);?></td><td><divclass="btn-group"><buttontype="button"class="btn btn-info"data-toggle="modal"data-target="#myVie<?phpecho$row['trackingnumber'] ?>">View</button></div><?phpinclude ('order_history_modal.php'); ?></td></tr><?phpendforeach;?></tbody></table>

order_history_modal.php

<divid="myVie<?phpecho$row['trackingnumber'] ?>"class="modal fade"role="dialog"><!-- Modal content--><divclass="modal-content"><divclass="modal-header"><buttontype="button"class="close"data-dismiss="modal">&times;</button><h4class="modal-title">Modal Header</h4></div><divclass="modal-body"><divclass="table-responsive"><tableclass="table"><thead><tr><th>Item</th><th>Quantity</th><th>Price</th></tr></thead><tbody><?php$notal = DataDB::getInstance()->select_from_where('order_details','trackingnumber',$row['trackingnumber']);             
                foreach($notalas$rol):
                    $prrname = DataDB::getInstance()->get_name_from_id('product_name','product','product_id',$rol['product_id']);?><tr><td><?phpecho$prrname?></td><td><?phpecho$rol['quantity'] ?></td><td><?phpecho"NGN ".number_format($rol['price'], 2);?></td></tr><?phpendforeach; ?></tbody></table></div></div><divclass="modal-footer"><buttontype="button"class="btn btn-default"data-dismiss="modal">Close</button></div></div></div>

<scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><!-- Latest compiled and minified CSS --><linkrel="stylesheet"href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"crossorigin="anonymous"><!-- Optional theme --><linkrel="stylesheet"href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css"integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp"crossorigin="anonymous"><!-- Latest compiled and minified JavaScript --><scriptsrc="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"crossorigin="anonymous"></script><tableclass="table"><thead><tr><th>#</th><th>Track Number</th><th>Price</th><th>Address</th><th>Order Date</th><th>Status</th><th>Auction</th></tr></thead><tbody><tr><td>1</td><td>test</td><td>test</td><td>test</td><td>test</td><td>test</td><td><divclass="btn-group"><buttontype="button"class="btn btn-info"data-toggle="modal"data-target="#myVie1">View</button></div><divid="myVie1"class="modal fade"role="dialog"><!-- Modal content--><divclass="modal-content"><divclass="modal-header"><buttontype="button"class="close"data-dismiss="modal">&times;</button><h4class="modal-title">Modal Header</h4></div><divclass="modal-body"><divclass="table-responsive"><tableclass="table"><thead><tr><th>Item</th><th>Quantity</th><th>Price</th></tr></thead><tbody><tr><td>test</td><td>test</td><td>test</td></tr></tbody></table></div></div><divclass="modal-footer"><buttontype="button"class="btn btn-default"data-dismiss="modal">Close</button></div></div></div></td></tr></tbody></table>

Post a Comment for "Load Foreach Table In A Modal Which Is Called From Another Foreach Table"