$username Posted July 14, 2008 Share Posted July 14, 2008 Hey guys and girls, So I have a if statement where I am trying to get a var to populate depending on what is selected. What I would like to do is something like this. Seems to me it just uses the last if statement. $PaymentTaxStatus = ereg_replace("[<>]", "", rtrim(addslashes($_POST['PaymentTaxStatus']))); $PaymentTaxAmount = ereg_replace("[<>]", "", rtrim(addslashes($_POST['PaymentTaxAmount']))); if ($PaymentTaxStatus = 0) $PaymentTaxAmount = '0'; if ($PaymentTaxStatus = 1) $PaymentTaxAmount = '$CompanyTaxCode'; if ($PaymentTaxStatus = 2) $PaymentTaxAmount = '$CompanyTaxCode'; if ($PaymentTaxStatus = 3) $PaymentTaxAmount = '0'; if ($PaymentTaxStatus = 4) $PaymentTaxAmount = "$PaymentTaxAmount"; thank you Link to comment https://forums.phpfreaks.com/topic/114734-solved-if-statement/ Share on other sites More sharing options...
$username Posted July 14, 2008 Author Share Posted July 14, 2008 I got it needed the == if ($PaymentTaxStatus == 0) $PaymentTaxAmount = '0'; if ($PaymentTaxStatus == 1) $PaymentTaxAmount = $CompanyTaxCode; if ($PaymentTaxStatus == 2) $PaymentTaxAmount = $CompanyTaxCode; if ($PaymentTaxStatus == 3) $PaymentTaxAmount = '0'; if ($PaymentTaxStatus == 4) $PaymentTaxAmount = "$PaymentTaxAmount"; Link to comment https://forums.phpfreaks.com/topic/114734-solved-if-statement/#findComment-589980 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.