...

View Full Version : urlencode this string?



fuzzy1
10-29-2006, 01:35 AM
I'm having a time getting the following string urlencoded for google maps.

$overlib_string = '';
if(!empty($fields['PRIMARY_ADDRESS_STREET']) || !empty($fields['PRIMARY_ADDRESS_CITY']) ||
!empty($fields['PRIMARY_ADDRESS_STATE']) || !empty($fields['PRIMARY_ADDRESS_POSTALCODE']) ||
$overlib_string .= '<b>' . $mod_strings['LBL_PRIMARY_ADDRESS'] . '</b><br>';
if(!empty($fields['PRIMARY_ADDRESS_STREET'])) $overlib_string .= $fields['PRIMARY_ADDRESS_STREET'] . '<br>';
if(!empty($fields['PRIMARY_ADDRESS_STREET_2'])) $overlib_string .= $fields['PRIMARY_ADDRESS_STREET_2'] . '<br>';
if(!empty($fields['PRIMARY_ADDRESS_STREET_3'])) $overlib_string .= $fields['PRIMARY_ADDRESS_STREET_3'] . '<br>';
if(!empty($fields['PRIMARY_ADDRESS_CITY'])) $overlib_string .= $fields['PRIMARY_ADDRESS_CITY'] . ', ';
if(!empty($fields['PRIMARY_ADDRESS_STATE'])) $overlib_string .= $fields['PRIMARY_ADDRESS_STATE'] . ' ';
if(!empty($fields['PRIMARY_ADDRESS_POSTALCODE'])) $overlib_string .= $fields['PRIMARY_ADDRESS_POSTALCODE'] . ' ';
if(strlen($overlib_string) > 0 && !(strrpos($overlib_string, '<br>') == strlen($overlib_string) - 4))
$overlib_string .= '<br>';

I've been playing around with:

"<a href='http://maps.google.com/?hl=en&q=" . urlencode("
{$fields['PRIMARY_ADDRESS_STREET']} {$fields ['PRIMARY_ADDRESS_CITY']} {$fields['PRIMARY_ADDRESS_STATE']}
{$fields['PRIMARY_ADDRESS_POSTALCODE']}
") . "&f=q' target='_blank'></a><br>";

but haven't had any luck at all.

boeing747fp
10-29-2006, 03:47 PM
there should not be any linebreaks in your url tags
try this

"<a href='http://maps.google.com/?hl=en&q=" . urlencode("{$fields['PRIMARY_ADDRESS_STREET']} {$fields ['PRIMARY_ADDRESS_CITY']} {$fields['PRIMARY_ADDRESS_STATE']} {$fields['PRIMARY_ADDRESS_POSTALCODE']}") . "&f=q' target='_blank'></a><br>";



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum