Skip to main content
May 25, 2009
Answered

Php question

  • May 25, 2009
  • 1 reply
  • 381 views

I have this calculation: <?php echo $subTotal + $shipTotal; ?>

where $shipTotal should be 50 if $shipTotal is more or the same as 50.

This is what I have found out so far:

<?php
if ($shipTotal < 50) {
    echo $shipTotal;
} elseif ($shipTotal >= 50) {
    echo "50";
}
?>

But I don't know how to put it in the calculation (so that $shipTotal is not getting more than 50).

Thankx for any further help and tips.

This topic has been closed for replies.
Correct answer David_Powers

You're nearly there.

<?php
if ($shipTotal >= 50) {
    $shipTotal = 50;
}

echo $subTotal + $shipTotal;

?>

1 reply

David_Powers
David_PowersCorrect answer
Inspiring
May 25, 2009

You're nearly there.

<?php
if ($shipTotal >= 50) {
    $shipTotal = 50;
}

echo $subTotal + $shipTotal;

?>