with PHP and through an SQL query, I get some parameters, which I show through a for and that end up showing up as a link. This is easy to implement and it works, but I want that link to be inside an HTML canvas and this is where the problems appear, because, if I put the link in a PHP variable and then I pass it to a Javascript variable that then I put in the canvas as text, what it does is show me the link as text with all the HTML code. I say there must be a simpler way to do it.
Something like what I'm going to say next:
function crearcanvas(enlace) {
var link = enlace;
var canvas = document.getElementById("canvas");
canvas.fillStyle = '#CCCC00';
canvas.font = "sans-serif";
canvas.fillStyle = "black";
canvas.fillText(enlace,45,75);
....
....
}
<php
$tabla = tabla();
foreach ($db->query($tabla) as $row) {
$valor1 = $row['valor1'];
$valor2 = $row['valor2'];
$valor3 = $row['valor3'];
$enlace = "<a href='pagina.php?valor1=".$valor1."&valor2=".$valor2."'>".$valor3."</a>";
?>
<canvas id="canvas"></canvas>
<script>
var enlace = <?php echo $enlace; ?>;
crearcanvas(enlace);
</script>
<?php
}
?>
One thing, I'm not looking to create a button or an animation, I just want to put a simple link inside the canvas.