i want to change div value when clicking php while loop., My php code
<?php $query = mysql_query("select * from tbl_sub_product where product_id='$id'"); 
           while($row=mysql_fetch_array($query))
          {    ?>  
<div><a href="#" class="showElement" id="showElement" >
<?php echo $row['name']; ?><?php echo $row['id']; ?></a></div>
                                <?php } ?>  
my query was
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
var $target = $('#target');
$(".showElement").click( function(e) {
    e.preventDefault();
    $target.append( $(this).text() );
});
});
</script>
i want the result in this div
 <div id="target">user Id:<php echo $id ?>User Nmae:<?php echo $name ?>user designation :<?php echo $designation ?></div>
what changes i want to do my code for getting data in my second div
 
     
    