DrNeo
DrNeo

Reputation: 13

Embedd HTML code from PHP variable

After more than 3 hours searching in google, I found that ppl do the other way around of what I am doing but anyway, here is what I want to do:

I have a variable $location which contains an HTML code (embedded google map code) i.e.

<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0"  
        marginwidth="0" src="https://www.google.com/maps/ms?........in a larger 
        map></iframe>

now in a php code, how can i get the map to be displayed? the following outputs the HTML code as text

<?php echo $loation; ?>

Thanks!

Upvotes: 0

Views: 105

Answers (1)

Revent
Revent

Reputation: 2109

You spelled your variable name wrong $loation; - should be $location;. Assuming you set your variable correctly like

$location = '...';

OR using heredoc syntax:

$location = <<<STR
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0"  
        marginwidth="0" src="https://www.google.com/maps/ms?........in a larger 
        map></iframe>
STR;

you should be fine.

Upvotes: 1

Related Questions