<?php foreach ($data['ACTION_DATA']['messages'] as $msg) { ?>
<form>
<table>
<tr><td>Name:</td><td id="name"><?php echo $msg['name']; ?> </td></tr>
<tr><td>Telephone Number:</td><td id="tp"><?php echo $msg['tp_number']; ?></td></tr>
<tr><td>ID:</td><td id="id"><?php echo $msg['id']; ?> </td></tr>
<tr><td colspan="2"><input type="button" id="sub_button" onclick="show_popup()" value="View"></td></tr>
</table>
</form>
<?php }; ?>
I used above code sample to display my page content. I want to get values according to instance block. and display them in popup window when click on the “View” button without re-load the page. pleace help me. thanks.
I would add another input, with type hidden to hold the total number of entries. I would have each name, telephone and id inputs have different ids by adding an index number for each, something like:
And then use a for loop (you can get the total number of entries form the hidden input field) to browse through all the values.
If you want to only view one of them, send the index number as a parameter to the show_popup() method.