Click to display record for specific user in popup

By | August 20, 2018

I am using CodeIgniter, I am displaying all the list in the table like below example.

 Id  |Name | Email        | Mobileno | Action
  1  |ABC  ||1654789523| View Archive
  2  |xyz  ||3214569874| View Archive

Now When I am clicking on the view button of id 1 then the popup will display with all the information but my issue is, I am getting only the last user id value in the popup. I mean it’s displaying only the records of Id 2.

list code

   <?php  $n=1;
           foreach ($cust_personal as $row)  
           {  ?>
            <td><?php echo $n;?></td>
            <td><?php echo $row->id;?></td>
            <td><?php echo $row->name;?></td>
            <td><?php echo $row->email;?></td>    
            <td><?php echo $row->mobileno;?></td>
            <a  href="javascript:void(0)" onclick="view(this)" data-id="<?=$row->id;?>"> <span>View</span></a>
            <a  href="javascript:void(0)" onclick="archive(this)" data-id="<?=$row->id;?>"> <span>archive</span></a>
<?php $n++;}?>


popup code

<div class="profile" id="profile-<?=$row->id;?>" style="display: none;">
//details list



function view(obj) 
    var id = $(obj).data('id');
Category: php

Leave a Reply

Your email address will not be published. Required fields are marked *