I want to replace all of the ' in a string to \' because the string is later inserted into a inline dhtml event like this
<a href=javascript:void(0) onclick="dohint('David's birthday is today...')">
Notice that the ' in David's terminates the string early...
I need to replace the ' with \' before it is echoed.
I have tried str_replace like this...
$rowdesc=str_replace("'","\'",$rowdesc);
but it either returns an empty string or the original... 😕
What am I doing wrong?