Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Apr 2006
    Posts
    311
    Thanks
    17
    Thanked 0 Times in 0 Posts

    urlencode this string?

    I'm having a time getting the following string urlencoded for google maps.
    PHP Code:
        $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) > && !(strrpos($overlib_string'<br>') == strlen($overlib_string) - 4)) 
            
    $overlib_string .= '<br>'
    I've been playing around with:
    PHP Code:
    "<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.

  • #2
    Regular Coder
    Join Date
    Oct 2003
    Posts
    603
    Thanks
    2
    Thanked 1 Time in 1 Post
    there should not be any linebreaks in your url tags
    try this
    PHP Code:
    "<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>"


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •