Re: case
| From: | Martin Clifford | Date: | Tue, 11 Jun 2002 14:24:22 +0000 |
| Subject: | Re: case | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-19745@lists.php.net to get a copy of this message | ||
Use strtolower() on all entries from the form, so you can compare them (in lowercase) without worry
about whether the user entered "MA", "ma", "Ma", or "mA".
Martin
>>> "James Kupernik" <kupernik@bcn.net> 06/11/02 10:15AM >>>
I want to test a value that was typed into a form, but I don't want the case
to be a problem, how can I get around this??
This is what I have now:
function calculate_tax($OrderedByState,$ShipState)
{
global $totalPrice;
//tax calculation
$taxRate = "0.05";
if ($OrderedByState=="MA" && $ShipState=="MA") {
$taxcost=$taxRate*$totalPrice;
} else if ($OrderedByState=="MA" && $ShipName != "" &&
$ShipState!="MA") {
$taxcost= "0.00";
} else if ($OrderedByState=="MA" && $ShipState=="") {
$taxcost=$taxRate*$totalPrice;
} else if ($ShipState=="MA") {
$taxcost=$taxRate*$totalPrice;
} else {
$taxcost= "0.00";
}
return $taxcost;
}
Thanks for any help!
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php