PHP から JavaScript に任意の種類の変数を渡す際に問題が発生しています。jsFiddle の簡単な例を次に示します。文字列が返されないのはなぜですか?
http://jsfiddle.net/funinabox/VkNe2/1/
<?php
//create php test string
$teststring = "mystring";
?>
//Convert Php string to JavaScript string
var testvar = <?php echo $teststring; ?> ;
//Display output of the array elements;
alert(testvar);