I have to add a url into a data-url attribute in a button element. But from the url image, I have to add id and book name which are php variables. How can I add this two php variables in my data-url attribute?
This is the URL : http://localhost/book%20store/detail.php?id=53&cat=Game Of Thrones
This is my code (I've tried this but this is not working):
$book_id = $row['b_id'];
$book_name = $row['b_nm'];
echo'<table>
<tr>
<button class="sharer btn btn-lg"
data-url="http://localhost/book store/detail.php?id={$book_id}&cat={$book_name}" >
Share to Facebook </button>
</tr>
</table>';
from the url : $row['b_id'] = 53
And $row['b_nm']=Game Of Thrones