Improperly called Javascript function (parameter issue)
- by 13rave
I am trying to echo some HTML using PHP in a div. Everything was working until I tried to pass a parameter to the onclick=\"loadpuzzle()\" function. It ran fine when I tried onclick=\"loadpuzzle(4)\" and the function took the parameter and executed normally, but what I need is to pass the value from $row['puzzlename'] as the parameter, which I assume is a string (and so I enclosed it in quotation marks).
echo "<td><input id=\"".$row['puzzlename']."\" type=\"radio\" name=\"puzzle-set\" class=\"puzzle_selector\" onclick=\"loadpuzzle(\"".$row['puzzlename']."\")\"/>
<label for=\"".$row['puzzlename']."\" class=\"puzz_label\">".$row['puzzlename']."</label></td>";
I am getting a weird error in Safari when I try to run this. "Unexpected token: '}' ".
Does anyone know what I am doing wrong here? Why won't it take this parameter?
Thank you!