Q:

concatenating a comma character to a string

I'm using php to generate an href that should call on a javascript function
here's what I had attempted so far:
echo "<td><a href=". "#" . " onclick=" . "edit_pub(" . $row["Publication_no"] . "," . $row["Title"] . ")" . ">edit</a></td>";

which I had expected to generate:
<td><a href="#" onclick=edit_pub(parm1,parm2)>edit</a></td>

when I click the href I get:

Uncaught ReferenceError: asd is not defined

where asd is the second param
I've tried echoing 2 strings with a comma in between:
$title = $row["Title"] . ' , ' . "test";
echo $title;

That only prints the first variable.
How can I print something like:
param1,param2

Thanks

A:

In your case, asd is a string, so the resulting output looks like:
...edit_pub(xxx, asd)...

You can see that asd is not quoted on the client.  If you're echoing out strings, you need to make sure you remember to requote them for JavaScript:
echo "<td><a href=". "#" . " onclick=" . "edit_pub('" . $row["Publication_no"] . "','" . $row["Title"] . "')" . ">edit</a></td>";

