html - PHP: Trouble composing strings -


i'm using php code

echo " onclick='myfunction(" . $row['username'] . ")'" 

that give me result

onclick="myfunction(francis88)" 

but want this:

onclick="myfunction('francis88')" 

how should change php code obtain this?

use \ escape character within string, example:

echo " onclick=\"myfunction('" . $row['username'] . "')\"" 

Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -