I thought I had things working until I discovered that if one field has no data (which is possible), that:
- In the final $maplink equation, I need to eliminate the "+" sign right-before &zip IF $suffix is blank:
http://www.mapquest.com/maps/map.adp?country=us&city=Boom_City&state=NV&address=123+Via_Del_Playa+&zip=99999&zoom=8
- In the final $propaddr equation, if $suffix is blank, to NOT include what now would be a " " right after $street
I've included comments (below) about the problem.
Thanks for any help in resolving these issues.
<?
?>
<HTML>
<HEAD><TITLE>MapLink & PropAddr NO SUFFIX Code Test</TITLE>
</HEAD>
<BODY>
<?
$addrnum="123";
$street="Via Del Playa";
// $suffix MAY be omitted or blank!!! What to do below???
$suffix="";
$propaddr="$addrnum $street $suffix";
// If $suffix is blank, how NOT to include in $propaddr???
echo "<br>";
echo "$propaddr";
$city="Boom City";
$state="NV";
echo "<br>";
$zip="99999";
$maplink="http://www.mapquest.com/maps/map.adp?country=us&city=$city&state=$state&address=$addrnum+$street+$suffix&zip=$zip&zoom=8";
$maplink = str_replace(" ", "_", $maplink);
//if $suffix is blank, how NOT to include the "+" RIGHT-BEFORE "&zip" in the above???
echo "$maplink";
?>
</body>
</html>
<?
?>