to address your two questions:
1.
echo " <b>from</b> $location \n<br>";
note that <b> is just a basic html tag, like <br> ...
2.
change it to
if(strlen($location)) echo " <b>from</b> $location \n<br>";
that says 'if $location has any length, then do the following statement (echo...)'
best
Eric