Jump to content

string not showing correctly


fife

Recommended Posts

Hi.  I am try to implement a go dynamic google maps feature into my website.  If i put a static address into my code it works great.  If then I use a variable it all goes wrong.  Here is the line Im having trouble with.

 

$address = ' address';
$address = urlencode($address);

//so here is the static version that works great!!!!!!!!!!!!!!!!!!!
$address = ' 45 chapel road, preston, lancashire, pr4 6rt, uk';
$address = urlencode($address);

// and a version that does not work.
$address = '$addressL1, $area, $county, $postcode, $country';
$address = urlencode($address);


// another that does not work
$address = ' {$addressL1}, {$area}, {$county}, {$postcode}, {$country}';
$address = urlencode($address);

 

 

If I view the source code when i load the page in the browser its obvious why the code is not working.  See below.

 

 

      <iframe width="193px" height="160px" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=+%24addressL1%2C+%24area%2C+%24county%2C+%24postcode&aq=0&ie=UTF8&hq=&hnear=+%24addressL1%2C+%24area%2C+%24county%2C+%24postcode&t=m&ll=,&z=12&iwloc=

&output=embed"></iframe>

 

As you can see the variable's are echoing wrong.  Can someone please tell me how to write them within the string so they output their actual values.  I know they have value as they are also echod on the page else where. 

 

Thanks

 

Danny

Link to comment
https://forums.phpfreaks.com/topic/258248-string-not-showing-correctly/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.