In my code I'm returning a array
of items/designs which im previewing using HTML
as you can see in the following screenshot:
Once I'm clicking on a item/design a form modal will popup and offer the user some selects
and input
fields.
The code looks like the following:
<?php foreach($designs as $design): ?>
<!-- HTML code to display designs which are returned from a PHP class -->
<?php endforeach; ?>
<div id="modal_form_vertical" class="modal fade">
<!-- Modal HTML code -->
</div>
As you can see I'm storing the modal
code outside the foreach
loop.
Since I'm able to click different items/designs I'm not sure how to use the urls/names/ids which are returned by the index position of the array.
Question: How would I use the PHP variables
which are aviable inside the foreach
loop inside the modal
? Do I really have to create a modal
foreach
design/items by placing the modal
code inside the foreach
loop?