Jump to content

[SOLVED] IF statement


$username

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.