2
Hello, I want to pass a php variable as a parameter in a Javascript function call. So:
<a href="calcular($numero)">Calcular</a>
I’ve tried it this way:
<a href="calcular(<?php echo $numero; ?>)></a>
However, the detail that makes it difficult, is that <a></a>
is already inside a <?php ?>
for being in a while.
Any idea of resolution?
You can simply use concatenation, without using the
<?php
. Something like that:<a href="calcular('.$numero.')></a>
, but it depends a little on how you’re using the quotes. You can put the code of thatwhile
?– Sergio