What you also need is to have a closer look at how PHP handles strings with quotes. This is one of the biggest "problems" developers have when making PHP-code that eg. produce JavaScript which in turn makes other JavaScript or HTML-code. Trust me - look closely at strings and qoutes in PHP!