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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.