I have text boxes on my form for users to enter a range of numbers that they would like to see in the database. I would like to query to ignore the range if the user does not enter anything in the box.
To do this, I basically said if the variables are empty to reassign them with the minimum and maximum number possible.
Here is the code I have for that:
It works fine, but seems clunky. Is there a more effecient way to do this?
Any help would be appreciated. I am using MySQL 5.0 and PHP 5.1.4
To do this, I basically said if the variables are empty to reassign them with the minimum and maximum number possible.
Here is the code I have for that:
Code:
$min = $_POST['min'];
$max = $_POST['max'];
if ($min == "") {
$minNew = 0;
}
else {
$minNew = $min;
}
if ($max == "") {
$maxNew = 2000;
}
else {
$maxNew = $max;
}
It works fine, but seems clunky. Is there a more effecient way to do this?
Any help would be appreciated. I am using MySQL 5.0 and PHP 5.1.4