экранирование кавычек при выводе html кода http://otvet.mail.ru/question/58767041/
htmlspecialchars($str, ENT_QUOTES)