The ranges are 0-100, 101 - 300, 301-500, 501 - 1000, right?
The simplest solution would be to write a function that returns 100, 300, 500 or 1000 depending on the weight you've entered in the form.
function getRange($weight) {
$range = -1;
if ($weight <= 100) {
$range = 100;
} else if ($weight > 100 && $weight <= 300) {
$range = 300;
} else if ($weight > 300 && $weight <= 500) {
$range = 500;
} else if ($weight > 500 && $weight <= 1000) {
$range = 1000;
}
return $range;
}
$getprice = "SELECT * from priceMatrix
WHERE VENDOR='$vendorArray[$i]'
AND SERVICE=$serviceArray[$s]
AND WEIGHT =" . getRange(intval($HTTP_POST_VARS['weight']));