My problem is that I have a button which sends a parameter to a javascript function. When I receive it in this function, I want to execute an sql query where the where includes this received variable (this to generate a pdf jspdf and not having to visualize all the fields to download). My query is if it is possible to receive this variable in PHP, because when I print the alert it shows me an empty field.
<?php
function prueba(dse) { //debería ir sobre el php
$a=dse;
$q=mysql_query("SELECT id FROM tabla WHERE id='$a'");
$ro=mysql_fetch_array($q);
alert(<php? echo $ro['id'];?>);//deberia ir bajo del PHP
?>
Thankful for answers and any alternative is valid