Passing a String from PHP to a JavaScript function
- by user635614
Hello.
am trying to write a code to pass a php string when clicked on the table :
<?php
. . .
echo("<td onclick = 'print_("$file[$i]->Name");' >". $files[$i]->Name."</td>");
...
?>
where files[] is an array, and each element is a class with Name as a String, and it is put in a ''for'' loop,
Am trying to pass it to a JavaScript function where i need the name there,and it's not working,i tried passing the i variable and it was passed correctly so i thought there should be a special syntax for dealing with strings...
function print_(var x) {
alert(x);}