javascript - How to pass image,title and description to Bootstrap Modal popup? -
how can pass image,title , description bootstrap modal? when 1 image link click modal open image title , description. code is:
<?php $result = mysql_query("select * project"); $file_path = 'admin1\projectimages/'; while($post=mysql_fetch_array($result)){ $id=$post['id']; $ptitle=$post['title']; $image=$post['image']; $des=$post ['description']; $src = $file_path . $post['image']; echo'<li class="col-md-4 col-sm-6"><a href="#modal" class="fa" data-toggle="modal" data-placement="right"><h4 class="project_heading">'.$ptitle.'</h4></a> <a href="#modal" class="fa ok " data-toggle="modal" data-target="#modal" data-placement="right"><img src='.$src.' style="width:250px; border:1px solid red;"></a></li>';} ?>
modal code:
<div class=" modal fade bs-example-modal-lg" role="dialog" id="modal" aria-hidden="true" data-keyboard="true" data-backdrop="static" tabindex="-1"> <a href="#modal" class="fa fa-times cls-pop" data-dismiss="modal" id="thanks" ></a> <div class="modal-dialog modal-lg clearfix"> <div class="modal-content pop-up"> <h3 >title</h3> <div class="clearfix"> <div> <img src=" " style="width:99%; border:1px solid red;"> <p></p><p ></p> <p></p></div> </div> </div> </div> </div>
you can pass data php html using echo
.
so here: <h3 >title</h3>
you put: <h3><?php echo $ptitle; ?></h3>
the shorter notation <?= $ptitle; ?>
it work fine long 1) html working , 2) variables getting populated.
Comments
Post a Comment