从数据库中获取嵌入式地图代码,并使用输入形式作为值


getting embedded map code from database and using in input form as value

我已经将以下地图代码存储在mySQL数据库中,而不改变某些东西,当我从数据库检索此值并输出它时,正确的地图显示出来。

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false">    </script><div style="overflow:hidden;height:500px;width:600px;"><div id="gmap_canvas" style="height:500px;width:600px;"></div><style>#gmap_canvas img{max-width:none!important;background:none!important}</style><a class="google-map-code" href="http://www.mapsembed.com/voelkner/" id="get-map-data">http://www.mapsembed.com/voelkner/</a></div><script type="text/javascript"> function init_map(){var myOptions = {zoom:14,center:new google.maps.LatLng(40.8054567,-73.96547470000002),mapTypeId: google.maps.MapTypeId.ROADMAP};map = new google.maps.Map(document.getElementById("gmap_canvas"), myOptions);marker = new google.maps.Marker({map: map,position: new google.maps.LatLng(40.8054567, -73.96547470000002)});infowindow = new google.maps.InfoWindow({content:"<b>The Breslin</b><br/>2880 Broadway<br/> New York" });google.maps.event.addListener(marker, "click", function(){infowindow.open(map,marker);});infowindow.open(map,marker);}google.maps.event.addDomListener(window, 'load', init_map);</script>

但是当我在输入形式的值中使用上面的代码时,它不起作用。我也尝试过addslashes(),但没有工作

代码包含在HTML-attributes中使用时必须编码的字符(< > "):

<input value="<?php echo htmlentities($row['map']); ?>">
但是,这将把代码打印为输入的值,仅此而已。