Search code examples
phphtmlsyntaxquotes

Syntax problem with quotes in PHP and HTML


I have this php code

echo "<textarea id='textarea' cols='70' rows='5' name='code'>".$code."</textarea>";

and I need to put this onClick="SelectAll('txtarea');" after id='textarea' but the quotes are messing me up and I cant figure it out.

Any help?

Thanks!


Solution

  • Try this: echo "<textarea id='textarea' onClick=\"SelectAll('txtarea');\" cols='70' rows='5' name='code'>".$code."</textarea>";