I'm trying to create a modal window that will bring from a MySQL database only the final part of a URL of an image that is available on the internet (ex: part_final.png) the problem is that I can not do the code works in the concatenation, as I need to add the initial part of the URL (eg link ) to the rest of the url that comes from the database.
Firstly I have a query to DB to loop all the images that are stored with their URLs, to generate the various buttons each one should present a different image.
<?php
$sql = "SELECT * FROM imagens";
$conn = mysql_query($sql, $conecta);
while($row = mysql_fetch_assoc($conn))
{
?>
<a href="#" onClick={"$('#imgTag').attr('src', 'http://www.algumsite=<?php echo $row['img_url'];?>')"} type="button" class="btn btn-danger" data-toggle="modal" data-target="#imgModal">BUTTON</a>
<?php } ?>
<!-- Modal -->
<div class="modal fade" id="imgModal" tabindex="-1" role="dialog" aria- labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">ITEM</h4>
</div>
<div class="modal-body">
<img id="imgTag">
</div>
</div>
I do not know if I explained myself well, but what I want to do is a bit strange, but it has to be anyway, concatenate the initial part of the url with the final part of the url that comes from DB by PHP.
Instead of calling the onclick () function on the button, I can consider examples of an external function by Jquery, but in my case it is not necessary, thank you right now for the possible help, I'm really stranded here!