Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Php question

Guest
May 25, 2009 May 25, 2009

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.

TOPICS
Server side applications
363
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , May 25, 2009 May 25, 2009

You're nearly there.

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

echo $subTotal + $shipTotal;

?>

Translate
LEGEND ,
May 25, 2009 May 25, 2009
LATEST

You're nearly there.

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

echo $subTotal + $shipTotal;

?>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines