php - Bootstrap: Trouble using modal for showing dynamic data -
i have list created dinamically using php
while($row = $result->fetch_assoc()){ //$row row fetched database <tr> <td><?php echo $row['id']?></td> <td><?php echo $row['name']?></td> <td><?php echo $row['surname']?></td> <td><a href="#modal" <?php echo "id= " . $row['username'] ?> class="btn btn-small btn-info" data-toggle="modal" > vedi</a></td> </tr> }
modal this:
<div id="modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="modallabel" aria-hidden="true"> <div class="modal-header"> <a class="close" data-dismiss="modal" aria-hidden="true">×</a> <h3 id="mymodallabel">user information</h3> </div> <div class="modal-body" id="loadinfo"> <div class="row-fluid"> <div class="span12"> <!-- php code here --> </div> </div> </div> </div>
my php code must referred precise user. need modal can receive id of in order execute proper php code.
how can obtain result?
assign values of user info javascript variables. add data attribute modal toggle buttons data-user_id=<?php echo $row['id']; ?>
, make jquery click handler update modal's content match button clicked.
Comments
Post a Comment