Unterminated string constant in Google Map API using PHP -


i have problem unterminated string constant.

here code in php:

'html' => '<div><table><td><tr><img src="' . "http://www.simbawave.com/_lib/file/img/hotel/$folderhotel/$namafile" . '"width="200" height="200" /></tr><tr><p><b>'.$hotel."</b></p></tr></td><td>$alamat</td></table></div>",  

and here html source (result, not all, long)

markers[8] = new google.maps.marker({     icon: "http://www.simbawave.com/mapblueicon/villa.png",     title: "bali dynasty resort",     position: new google.maps.latlng(-8.747509, 115.16764),     map: map }); infos[8] = new google.maps.infowindow({     content: "<div><table><td><tr><img src=\"http://www.simbawave.com/_lib/file/img/hotel/ho-00009/depan2web.jpg\"width=\"200\" height=\"200\" /></tr><tr><p><b>bali dynasty resort</b></p></tr></td><td> jln. kartika po box 2047 tuban 80361 south kuta bali - indonesia</td></table></div>" }); 

if remove variable $alamat, fine, no problem. ad $alamat, don't have idea what's wrong php code.

the value of $alamat (string/varchar):

jln. kartika po box 2047 tuban 80361 south kuta 

but in html view, shown only:

jln. kartika po box 2047

i thought there should characters missing when passing html.

tuban 80361 south kuta bali - indonesia</td></table></div> 

i thought characters not passed , make error because $alamat contains multi lines not single line while $hotel contains single line of string.

anyone know how make varchar multi lines can used in php?

if can try not rely of php line breaks. put in <br />'s since passing html content anyways.

i having similar issue, however, html formatted... i'll update answer once can issue figured out :), now, str_replace , replace php linebreaks \r & \n <br />

i have fixed own issue, , wanted share did you.

function formatmapcontent($str){     return str_replace(array('.', "\n", "\t", "\r"), '', $str);  } 

wrap infowindow content that, , should go.

hth ~kevin


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -