Javascript function call from php with variables containing string and integer

  html, javascript, php

I have 2 php variable say $a="hello world",$b=10
I have the Javascript function printval(a,b)
but there is no action can be performed by button onclick function in javascript
I guess the issue is with my function call
how can I solve this?

Thanks in advance

(This is a sample code )

function printval(a,b)
{
document.write("hi"+a+b);
}
$a="hello world";
$b=10;
echo"<button type='button' onclick='printval($a,$b)' id='export' value='export' class='button'><h3>Export</h3></button><br>";

Source: Ask PHP

LEAVE A COMMENT