BBU MESSAGE FORUM + NEWS + RSS UPDATES View new messages in your reader RSS
Homepages for Salons and Spas Online Appointment Systems
Salon & Spa Message Forum Welcome to
Hair Say Newsroom


Welcome Guest
Please login or register
Home Help Search Login Register
Beautybyus.com  |  Members  |    Live Help  |  Free E-mail  |  RSS Newsroom  |  RSS Headlines  |  RSS Forum  |  May 13, 2008
Hair Say Newsroom : RSS Feed Item1 _ Feb 10/05
News Source
Hair Say

Add Mapquest To Your Site Using PHP

Thursday, February 10, 2005 Posted: 13:48 PM (EST)


You can easily create a MapQuest link at your website. When visitors see how close you really are to their home or travel route, they may just decide to give you a try.

The code has been tailored for locations throughout Canada and the United States. Try it by clicking the image and locating the Hair Say administrators.


Wednesday, January 18, 2007

Thanks go out to Dean for submitting an update to this code. He sent us a line to include in the script that will correct any problems that might arise if there is a # sign in the address.

$address = str_replace("#","%23",$address);


Thanks Dean !!!


Mapquest


Instructions:

- copy the code into your web document from <?php to Map Quest</a>
- edit items 1 to 5
- name your document using the .php extension (mydocument.php)
- your server must be equipped to handle php
- remove the unnecessary elseif statements once you have it working

<?php

// MapQuest® for USA and Canada in php
// simply copy and save this entire page as yourmap.php

// 1. change to "United States" if from the USA
$country = "Canada";

// 2. change to your address
$address1 = "Suite 311 - 2667 Young Street";

// do not edit this line
$address = $address1;

// 3. change this to your city
$city = "Kingston";

// 4. change this entry to your state or province exactly as written in the list below
$state = "Ontario";

// 5. enter your 6 character postal code or 5 digit zipcode
$postalcode = "K7K 6K8";

// do not edit below this line

?>
<?php

function mapquest_link($country,$address,$city,$state,$postalcode,$link = '')
{
if ($country == "United States")
{ $country="US"; }
elseif ($country == "Canada")
{ $country="CA"; }

// Convert state name to proper shortform
{
if ($state =="Alberta") { $state="AB"; }
elseif ($state == "British Columbia") { $state="BC"; }
elseif ($state == "Manitoba") { $state="MB"; }
elseif ($state == "New Brunswick") { $state="NB"; }
elseif ($state == "Newfoundland and Labrador") { $state="NL"; }
elseif ($state == "Northwest Territories") { $state="NT"; }
elseif ($state == "Nova Scotia") { $state="NS"; }
elseif ($state == "Ontario") { $state="ON"; }
elseif ($state == "Prince Edward Island") { $state="PE"; }
elseif ($state == "Quebec") { $state="QC"; }
elseif ($state == "Saskatchewan") { $state="SK"; }
elseif ($state == "Yukon Territory") { $state="YT"; }
elseif ($state == "Alabama") { $state="AL"; }
elseif ($state == "Alaska") { $state="AK"; }
elseif ($state == "Arizona") { $state="AZ"; }
elseif ($state == "Arkansas") { $state="AR"; }
elseif ($state == "California") { $state="CA"; }
elseif ($state == "Colorado") { $state="CO"; }
elseif ($state == "Connecticut") { $state="CT"; }
elseif ($state == "Delaware") { $state="DE"; }
elseif ($state == "District of Columbia") { $state="DC"; }
elseif ($state == "Florida") { $state="FL"; }
elseif ($state == "Georgia") { $state="GA"; }
elseif ($state == "Hawaii") { $state="HI"; }
elseif ($state == "Idaho") { $state="ID"; }
elseif ($state == "Illinois") { $state="IL"; }
elseif ($state == "Indiana") { $state="IN"; }
elseif ($state == "Iowa") { $state="IA"; }
elseif ($state == "Kansas") { $state="KS"; }
elseif ($state == "Kentucky") { $state="KY"; }
elseif ($state == "Louisiana") { $state="LA"; }
elseif ($state == "Maine") { $state="ME"; }
elseif ($state == "Maryland") { $state="MD"; }
elseif ($state == "Massachusetts") { $state="MA"; }
elseif ($state == "Michigan") { $state="MI"; }
elseif ($state == "Minnesota") { $state="MN"; }
elseif ($state == "Mississippi") { $state="MS"; }
elseif ($state == "Missouri") { $state="MO"; }
elseif ($state == "Montana") { $state="MT"; }
elseif ($state == "Nebraska") { $state="NE"; }
elseif ($state == "Nevada") { $state="NV"; }
elseif ($state == "New Hampshire") { $state="NH"; }
elseif ($state == "New Jersey") { $state="NJ"; }
elseif ($state == "New Mexico") { $state="NM"; }
elseif ($state == "New York") { $state="NY"; }
elseif ($state == "North Carolina") { $state="NC"; }
elseif ($state == "North Dakota") { $state="ND"; }
elseif ($state == "Ohio") { $state="OH"; }
elseif ($state == "Oklahoma") { $state="OK"; }
elseif ($state == "Oregon") { $state="OR"; }
elseif ($state == "Pennsylvania") { $state="PA"; }
elseif ($state == "Rhode Island") { $state="RI"; }
elseif ($state == "South Carolina") { $state="SC"; }
elseif ($state == "South Dakota") { $state="SD"; }
elseif ($state == "Tennessee") { $state="TN"; }
elseif ($state == "Texas") { $state="TX"; }
elseif ($state == "Utah") { $state="UT"; }
elseif ($state == "Vermont") { $state="VT"; }
elseif ($state == "Virginia") { $state="VA"; }
elseif ($state == "Washington") { $state="WA"; }
elseif ($state == "West Virginia") { $state="WV"; }
elseif ($state == "Wisconsin") { $state="WI"; }
elseif ($state == "Wyoming") { $state="WY"; }
}

// Trim address postalcode and city
{
$address = trim($address);
$address = str_replace("#","%23",$address);
$address = str_replace(" ","+",$address);
$address = str_replace(",","%2C",$address);
$city = trim($city);
$city = str_replace(" ","+",$city);
$postalcode = trim($postalcode);
$postalcode = str_replace(" ","+",$postalcode);

$link="http://www.mapquest.com/maps/map.adp".
"?country=$country".
"&amp;addtohistory=".
"&amp;address=$address".
"&amp;city=$city".
"&amp;state=$state".
"&amp;zipcode=$postalcode";
}
return $link;
}
?>
<a href="<?php echo mapquest_link($country,$address,$city,$state,$postalcode,'$link'); ?>" target="_blank">Locate with Map Quest</a>



Ron Poole is the managing editor of Hair Say Headlines and Hair Say Newsroom.
Copyright 2005 Beauty By Us Inc. All rights reserved. This material may not be published, broadcast, rewritten, or redistributed.


Top
People Online
3 Guests, 1 Member
Magic


NoWhere Radio.com
INDIE MUSIC & HOSTING

 Yahoo!
Homepages and Online Appointment Systems
Powered by MySQL Powered by PHP BBU Online Appointment System Forum
Powered by SMF 1.0.2.
© 2001-2005, Lewis Media. All Rights Reserved.
Valid XHTML 1.0! Valid CSS!

Beauty By Us Inc.
Kingston Ontario Canada K7K 6K8
Serving North America   (613) 547-3358

W3C P3P Compliant | PIPEDA Compliant