I 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.
I 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);
}