echo '<button class="modalInput" title="Is there an error in this question, report it here." rel="#prompt" onClick="params('.$item->catid.','.$item->id.',"'.$item->quote.'","'.$item->author.'");">';
今 - これは完全に正常に動作します - $item->quote と $item->author が次のような値を保持していない場合:
叔父の家 誰が「Ich bin ein Berliner」と言った?
次に、params文字列がかなりめちゃくちゃになります...
<button class="modalInput" title="Is there an error in this question, report it here." rel="#prompt" onClick="params(21,12,"Who said "ich bin ein Berliner"","George Bush");">
どうすればこれを修正できますか?
まだ動作しません
echo '<button class="modalInput" title="Is there an error in this question, report it here." rel="#prompt" onClick="params('.$item->catid.','.$item->id.',\''.htmlspecialchars($item->quote).'\',\''.(string) htmlspecialchars($item->author).'\');">';
になる
<button class="modalInput" title="Is there an error in this question, report it here." rel="#prompt" onClick="params(29,29,'In a FOX TV show, what did 'The OC' stand for','Orange County');">