Somehow my php function, which creates a button, which calls a javascript function, does not pass the php variables as strings.
function addTableEntry($id, $name)
{
echo('<tr>
<td>'.$id.'</td>
<td>'.$name.'</td>
<td><a href="#groups" onClick="activateGroupSettingsOverlay('.$id.','.$name.')">Manage group</a>
</tr>');
}
addTableEntry(1,"livingroom");
The function activateGroupSettingsOverlay()
always gets called with (1, livingroom) whenever it is clicked and i get an error "livingroom is undefined".
How can i pass $name as a String? I tried to put quotes around it (like this: '.$id.',"'.$name.'"
, but that did not work.