You could try your hand at using regex to solve your problem or you can take a look over at http://php.net for all the variable functions like is_numeric().
I also recommend you test the input like this:
<?php
$longitude = trim(htmlentities(strip_tags($_POST["Longitude"], ENT_QUOTES, 'UTF-8')));
//Make sure it isn't some long string of XSS or just a huge number...
if (strlen($longitude) > 15) {
print 'Your Longitude is too long...';
} else {
if(!is_numeric($longitude)) {
print 'This is not a valid number.';
} else {
print 'You entered the right number';
}
}
?>Also look at this