php脚本错误gving错误输出

php脚本错误gving错误输出,php,Php,在测试时,我对计算出20%的总数有点困难,我选择了它,所以“篮子”的值是60,我希望它显示60(它是这样的),但它应该计算出60+20%,读数应该是72,而不是144,我想知道你是否能帮上忙 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/

在测试时,我对计算出20%的总数有点困难,我选择了它,所以“篮子”的值是60,我希望它显示60(它是这样的),但它应该计算出60+20%,读数应该是72,而不是144,我想知道你是否能帮上忙

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Feet First</title>
    <link href="css/style.css" rel="stylesheet" type="text/css" />
    </head>

    <body>
    <!-- The container holds the entire website everything else is 'contained' within the container -->
    <div class="container">
      <div class="header">

        <img src="header.png" alt="logo" width="892" height="142" id="logo" />
    </div>
      <!-- The content divis the Secondary layer which contains the content of the webiste such as text and images.  -->
      <div class="content"> 
        <!-- Navi is what hols the navigation links at the top of the page -->
       <div class="navi">
       <!-- this is the unordered list for the menu items -->
       <ul id="menu">
       <li><a href="\index.html">Home</a></li>
       <li><a href="\trainers.html">Trainers</a></li>
       <li><a href="\order.html" >Order</a></li>
       <li><a href="\credits.html">Credits</a></li>
       <li></li>
       <li></li>
    </ul>
    </div>

    <div class="content"></div>



        <h1>Thank you for your order!</h1>
    <?php

    // sents the value of the items
      $extraValues = array(
          'Laces' => 5,
          'Shoe Polish' => 10,
          'In-souls' => 15
       );

       $trainerValues = array(
          'Lacoste' => 50,
          'K-Swiss' => 45,
          'Puma' => 59,
          'Converse' => 65
       );

       if(isset($_POST['firstname'])){
          $firstname = $_POST['firstname'];
          echo " $firstname ";
       }

       if(isset($_POST['lastname'])){
        $lastname = $_POST['lastname'];
        echo "$lastname <br />\n";
       }

      if(isset($_POST['add1'])){
        $add1 = $_POST['add1'];
        echo "$add1 <br />\n";
      }

     if(isset($_POST['add2'])){
      $add2 = $_POST['add2'];
      echo "$add2 <br />\n";
     }

      if(isset($_POST['postcode'])){
        $postcode = $_POST['postcode'];
        echo "$postcode <br />\n";
      }

      if(isset($_POST['email'])){
        $email = $_POST['email'];
        echo "Contact Email Address $email <br />\n";
      }

      if(isset($_POST['telephone'])){
      $telephone = $_POST['telephone'];
      echo "Contact Telephone Number $telephone <br />\n";
      }

      if(isset($_POST['contact'])){
      $contact = $_POST['contact'];
      echo "You would like to be contacted by $contact <br />\n";
      }

      if(isset($_POST['trainers'])){
      $trainers = $_POST['trainers'];
      echo "The trainers you would like are $trainers <br />\n";
      }



      if(isset($_POST['extras'])){
      $extras = $_POST['extras'];
      echo "The extras you would like are $extras <br />\n";
      }



       $extraCost = 0;
       $trainerCost= 0;
       $totalCost= 0;
       $totalCostV= 0;

        $extra = $_POST['extras'];

        if (array_key_exists($extra, $extraValues)) {
             $extraCost = (float) $extraValues[$extra]; 
            echo "The cost of your extras are &pound; $extraCost<br />\n";
        } 


        $trainer = $_POST['trainers'];

        if (array_key_exists($trainer, $trainerValues)) { 
            $trainerCost = (float) $trainerValues[$trainer]; 
            echo "The cost of your Trainers are &pound; $trainerCost<br />\n";
        }

        $totalCost = round($extraCost+$trainerCost+$totalCost); 
      echo "The cost of your Trainers are (Excluding 20% tax) &pound; $totalCost<br />\n";


      $totalCostV = round(($extraCost+$trainerCost+$totalCost)*1.20,2); 
      echo "The cost of your Trainers are (including 20% tax) &pound; $totalCostV<br />\n";
    ?>
      </div>

      <!-- Holds the foorter information -->
      <div class="footer">
        <p>&#169; 2010 FeetFirst Uk Ltd </p>
        </div>

      </div> 

    </body> 

先走一步
谢谢您的订单! ©;2010年FeetFirst英国有限公司

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Feet First</title>
    <link href="css/style.css" rel="stylesheet" type="text/css" />
    </head>

    <body>
    <!-- The container holds the entire website everything else is 'contained' within the container -->
    <div class="container">
      <div class="header">

        <img src="header.png" alt="logo" width="892" height="142" id="logo" />
    </div>
      <!-- The content divis the Secondary layer which contains the content of the webiste such as text and images.  -->
      <div class="content"> 
        <!-- Navi is what hols the navigation links at the top of the page -->
       <div class="navi">
       <!-- this is the unordered list for the menu items -->
       <ul id="menu">
       <li><a href="\index.html">Home</a></li>
       <li><a href="\trainers.html">Trainers</a></li>
       <li><a href="\order.html" >Order</a></li>
       <li><a href="\credits.html">Credits</a></li>
       <li></li>
       <li></li>
    </ul>
    </div>

    <div class="content"></div>



        <h1>Thank you for your order!</h1>
    <?php

    // sents the value of the items
      $extraValues = array(
          'Laces' => 5,
          'Shoe Polish' => 10,
          'In-souls' => 15
       );

       $trainerValues = array(
          'Lacoste' => 50,
          'K-Swiss' => 45,
          'Puma' => 59,
          'Converse' => 65
       );

       if(isset($_POST['firstname'])){
          $firstname = $_POST['firstname'];
          echo " $firstname ";
       }

       if(isset($_POST['lastname'])){
        $lastname = $_POST['lastname'];
        echo "$lastname <br />\n";
       }

      if(isset($_POST['add1'])){
        $add1 = $_POST['add1'];
        echo "$add1 <br />\n";
      }

     if(isset($_POST['add2'])){
      $add2 = $_POST['add2'];
      echo "$add2 <br />\n";
     }

      if(isset($_POST['postcode'])){
        $postcode = $_POST['postcode'];
        echo "$postcode <br />\n";
      }

      if(isset($_POST['email'])){
        $email = $_POST['email'];
        echo "Contact Email Address $email <br />\n";
      }

      if(isset($_POST['telephone'])){
      $telephone = $_POST['telephone'];
      echo "Contact Telephone Number $telephone <br />\n";
      }

      if(isset($_POST['contact'])){
      $contact = $_POST['contact'];
      echo "You would like to be contacted by $contact <br />\n";
      }

      if(isset($_POST['trainers'])){
      $trainers = $_POST['trainers'];
      echo "The trainers you would like are $trainers <br />\n";
      }



      if(isset($_POST['extras'])){
      $extras = $_POST['extras'];
      echo "The extras you would like are $extras <br />\n";
      }



       $extraCost = 0;
       $trainerCost= 0;
       $totalCost= 0;
       $totalCostV= 0;

        $extra = $_POST['extras'];

        if (array_key_exists($extra, $extraValues)) {
             $extraCost = (float) $extraValues[$extra]; 
            echo "The cost of your extras are &pound; $extraCost<br />\n";
        } 


        $trainer = $_POST['trainers'];

        if (array_key_exists($trainer, $trainerValues)) { 
            $trainerCost = (float) $trainerValues[$trainer]; 
            echo "The cost of your Trainers are &pound; $trainerCost<br />\n";
        }

        $totalCost = round($extraCost+$trainerCost+$totalCost); 
      echo "The cost of your Trainers are (Excluding 20% tax) &pound; $totalCost<br />\n";


      $totalCostV = round(($extraCost+$trainerCost+$totalCost)*1.20,2); 
      echo "The cost of your Trainers are (including 20% tax) &pound; $totalCostV<br />\n";
    ?>
      </div>

      <!-- Holds the foorter information -->
      <div class="footer">
        <p>&#169; 2010 FeetFirst Uk Ltd </p>
        </div>

      </div> 

    </body> 

我想您在
$totalCostV
中有一个exta
+$totalCost
可能是转换问题。听起来它是计算*2而不是*1.2。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Feet First</title>
    <link href="css/style.css" rel="stylesheet" type="text/css" />
    </head>

    <body>
    <!-- The container holds the entire website everything else is 'contained' within the container -->
    <div class="container">
      <div class="header">

        <img src="header.png" alt="logo" width="892" height="142" id="logo" />
    </div>
      <!-- The content divis the Secondary layer which contains the content of the webiste such as text and images.  -->
      <div class="content"> 
        <!-- Navi is what hols the navigation links at the top of the page -->
       <div class="navi">
       <!-- this is the unordered list for the menu items -->
       <ul id="menu">
       <li><a href="\index.html">Home</a></li>
       <li><a href="\trainers.html">Trainers</a></li>
       <li><a href="\order.html" >Order</a></li>
       <li><a href="\credits.html">Credits</a></li>
       <li></li>
       <li></li>
    </ul>
    </div>

    <div class="content"></div>



        <h1>Thank you for your order!</h1>
    <?php

    // sents the value of the items
      $extraValues = array(
          'Laces' => 5,
          'Shoe Polish' => 10,
          'In-souls' => 15
       );

       $trainerValues = array(
          'Lacoste' => 50,
          'K-Swiss' => 45,
          'Puma' => 59,
          'Converse' => 65
       );

       if(isset($_POST['firstname'])){
          $firstname = $_POST['firstname'];
          echo " $firstname ";
       }

       if(isset($_POST['lastname'])){
        $lastname = $_POST['lastname'];
        echo "$lastname <br />\n";
       }

      if(isset($_POST['add1'])){
        $add1 = $_POST['add1'];
        echo "$add1 <br />\n";
      }

     if(isset($_POST['add2'])){
      $add2 = $_POST['add2'];
      echo "$add2 <br />\n";
     }

      if(isset($_POST['postcode'])){
        $postcode = $_POST['postcode'];
        echo "$postcode <br />\n";
      }

      if(isset($_POST['email'])){
        $email = $_POST['email'];
        echo "Contact Email Address $email <br />\n";
      }

      if(isset($_POST['telephone'])){
      $telephone = $_POST['telephone'];
      echo "Contact Telephone Number $telephone <br />\n";
      }

      if(isset($_POST['contact'])){
      $contact = $_POST['contact'];
      echo "You would like to be contacted by $contact <br />\n";
      }

      if(isset($_POST['trainers'])){
      $trainers = $_POST['trainers'];
      echo "The trainers you would like are $trainers <br />\n";
      }



      if(isset($_POST['extras'])){
      $extras = $_POST['extras'];
      echo "The extras you would like are $extras <br />\n";
      }



       $extraCost = 0;
       $trainerCost= 0;
       $totalCost= 0;
       $totalCostV= 0;

        $extra = $_POST['extras'];

        if (array_key_exists($extra, $extraValues)) {
             $extraCost = (float) $extraValues[$extra]; 
            echo "The cost of your extras are &pound; $extraCost<br />\n";
        } 


        $trainer = $_POST['trainers'];

        if (array_key_exists($trainer, $trainerValues)) { 
            $trainerCost = (float) $trainerValues[$trainer]; 
            echo "The cost of your Trainers are &pound; $trainerCost<br />\n";
        }

        $totalCost = round($extraCost+$trainerCost+$totalCost); 
      echo "The cost of your Trainers are (Excluding 20% tax) &pound; $totalCost<br />\n";


      $totalCostV = round(($extraCost+$trainerCost+$totalCost)*1.20,2); 
      echo "The cost of your Trainers are (including 20% tax) &pound; $totalCostV<br />\n";
    ?>
      </div>

      <!-- Holds the foorter information -->
      <div class="footer">
        <p>&#169; 2010 FeetFirst Uk Ltd </p>
        </div>

      </div> 

    </body> 
您可以尝试在这些计算之前进行(浮点)转换

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Feet First</title>
    <link href="css/style.css" rel="stylesheet" type="text/css" />
    </head>

    <body>
    <!-- The container holds the entire website everything else is 'contained' within the container -->
    <div class="container">
      <div class="header">

        <img src="header.png" alt="logo" width="892" height="142" id="logo" />
    </div>
      <!-- The content divis the Secondary layer which contains the content of the webiste such as text and images.  -->
      <div class="content"> 
        <!-- Navi is what hols the navigation links at the top of the page -->
       <div class="navi">
       <!-- this is the unordered list for the menu items -->
       <ul id="menu">
       <li><a href="\index.html">Home</a></li>
       <li><a href="\trainers.html">Trainers</a></li>
       <li><a href="\order.html" >Order</a></li>
       <li><a href="\credits.html">Credits</a></li>
       <li></li>
       <li></li>
    </ul>
    </div>

    <div class="content"></div>



        <h1>Thank you for your order!</h1>
    <?php

    // sents the value of the items
      $extraValues = array(
          'Laces' => 5,
          'Shoe Polish' => 10,
          'In-souls' => 15
       );

       $trainerValues = array(
          'Lacoste' => 50,
          'K-Swiss' => 45,
          'Puma' => 59,
          'Converse' => 65
       );

       if(isset($_POST['firstname'])){
          $firstname = $_POST['firstname'];
          echo " $firstname ";
       }

       if(isset($_POST['lastname'])){
        $lastname = $_POST['lastname'];
        echo "$lastname <br />\n";
       }

      if(isset($_POST['add1'])){
        $add1 = $_POST['add1'];
        echo "$add1 <br />\n";
      }

     if(isset($_POST['add2'])){
      $add2 = $_POST['add2'];
      echo "$add2 <br />\n";
     }

      if(isset($_POST['postcode'])){
        $postcode = $_POST['postcode'];
        echo "$postcode <br />\n";
      }

      if(isset($_POST['email'])){
        $email = $_POST['email'];
        echo "Contact Email Address $email <br />\n";
      }

      if(isset($_POST['telephone'])){
      $telephone = $_POST['telephone'];
      echo "Contact Telephone Number $telephone <br />\n";
      }

      if(isset($_POST['contact'])){
      $contact = $_POST['contact'];
      echo "You would like to be contacted by $contact <br />\n";
      }

      if(isset($_POST['trainers'])){
      $trainers = $_POST['trainers'];
      echo "The trainers you would like are $trainers <br />\n";
      }



      if(isset($_POST['extras'])){
      $extras = $_POST['extras'];
      echo "The extras you would like are $extras <br />\n";
      }



       $extraCost = 0;
       $trainerCost= 0;
       $totalCost= 0;
       $totalCostV= 0;

        $extra = $_POST['extras'];

        if (array_key_exists($extra, $extraValues)) {
             $extraCost = (float) $extraValues[$extra]; 
            echo "The cost of your extras are &pound; $extraCost<br />\n";
        } 


        $trainer = $_POST['trainers'];

        if (array_key_exists($trainer, $trainerValues)) { 
            $trainerCost = (float) $trainerValues[$trainer]; 
            echo "The cost of your Trainers are &pound; $trainerCost<br />\n";
        }

        $totalCost = round($extraCost+$trainerCost+$totalCost); 
      echo "The cost of your Trainers are (Excluding 20% tax) &pound; $totalCost<br />\n";


      $totalCostV = round(($extraCost+$trainerCost+$totalCost)*1.20,2); 
      echo "The cost of your Trainers are (including 20% tax) &pound; $totalCostV<br />\n";
    ?>
      </div>

      <!-- Holds the foorter information -->
      <div class="footer">
        <p>&#169; 2010 FeetFirst Uk Ltd </p>
        </div>

      </div> 

    </body> 

因为JS浮动非常不准确,所以也可以用美分计算所有内容,然后在输出时除以100。

因为在开始时,您的$totalCost=0。然后它应该运行正常,如下所示:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Feet First</title>
    <link href="css/style.css" rel="stylesheet" type="text/css" />
    </head>

    <body>
    <!-- The container holds the entire website everything else is 'contained' within the container -->
    <div class="container">
      <div class="header">

        <img src="header.png" alt="logo" width="892" height="142" id="logo" />
    </div>
      <!-- The content divis the Secondary layer which contains the content of the webiste such as text and images.  -->
      <div class="content"> 
        <!-- Navi is what hols the navigation links at the top of the page -->
       <div class="navi">
       <!-- this is the unordered list for the menu items -->
       <ul id="menu">
       <li><a href="\index.html">Home</a></li>
       <li><a href="\trainers.html">Trainers</a></li>
       <li><a href="\order.html" >Order</a></li>
       <li><a href="\credits.html">Credits</a></li>
       <li></li>
       <li></li>
    </ul>
    </div>

    <div class="content"></div>



        <h1>Thank you for your order!</h1>
    <?php

    // sents the value of the items
      $extraValues = array(
          'Laces' => 5,
          'Shoe Polish' => 10,
          'In-souls' => 15
       );

       $trainerValues = array(
          'Lacoste' => 50,
          'K-Swiss' => 45,
          'Puma' => 59,
          'Converse' => 65
       );

       if(isset($_POST['firstname'])){
          $firstname = $_POST['firstname'];
          echo " $firstname ";
       }

       if(isset($_POST['lastname'])){
        $lastname = $_POST['lastname'];
        echo "$lastname <br />\n";
       }

      if(isset($_POST['add1'])){
        $add1 = $_POST['add1'];
        echo "$add1 <br />\n";
      }

     if(isset($_POST['add2'])){
      $add2 = $_POST['add2'];
      echo "$add2 <br />\n";
     }

      if(isset($_POST['postcode'])){
        $postcode = $_POST['postcode'];
        echo "$postcode <br />\n";
      }

      if(isset($_POST['email'])){
        $email = $_POST['email'];
        echo "Contact Email Address $email <br />\n";
      }

      if(isset($_POST['telephone'])){
      $telephone = $_POST['telephone'];
      echo "Contact Telephone Number $telephone <br />\n";
      }

      if(isset($_POST['contact'])){
      $contact = $_POST['contact'];
      echo "You would like to be contacted by $contact <br />\n";
      }

      if(isset($_POST['trainers'])){
      $trainers = $_POST['trainers'];
      echo "The trainers you would like are $trainers <br />\n";
      }



      if(isset($_POST['extras'])){
      $extras = $_POST['extras'];
      echo "The extras you would like are $extras <br />\n";
      }



       $extraCost = 0;
       $trainerCost= 0;
       $totalCost= 0;
       $totalCostV= 0;

        $extra = $_POST['extras'];

        if (array_key_exists($extra, $extraValues)) {
             $extraCost = (float) $extraValues[$extra]; 
            echo "The cost of your extras are &pound; $extraCost<br />\n";
        } 


        $trainer = $_POST['trainers'];

        if (array_key_exists($trainer, $trainerValues)) { 
            $trainerCost = (float) $trainerValues[$trainer]; 
            echo "The cost of your Trainers are &pound; $trainerCost<br />\n";
        }

        $totalCost = round($extraCost+$trainerCost+$totalCost); 
      echo "The cost of your Trainers are (Excluding 20% tax) &pound; $totalCost<br />\n";


      $totalCostV = round(($extraCost+$trainerCost+$totalCost)*1.20,2); 
      echo "The cost of your Trainers are (including 20% tax) &pound; $totalCostV<br />\n";
    ?>
      </div>

      <!-- Holds the foorter information -->
      <div class="footer">
        <p>&#169; 2010 FeetFirst Uk Ltd </p>
        </div>

      </div> 

    </body> 
$totalCost = round($extraCost+$trainerCost+$totalCost); 
echo "The cost of your Trainers are (Excluding 20% tax) &pound; $totalCost<br />\n";

$totalCostV = round($totalCost*1.20,2); // this line is edited
echo "The cost of your Trainers are (including 20% tax) &pound; $totalCostV<br />\n";
$totalCost=round($extract+$trainerCost+$totalCost);
echo“培训师的费用(不含20%的税费)£;$totalCost
\n”; $totalCostV=整数($totalCost*1.20,2);//此行已编辑 echo“培训师的费用(包括20%的税费)£;$totalCostV
\n”;
但我认为应该是这样的:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Feet First</title>
    <link href="css/style.css" rel="stylesheet" type="text/css" />
    </head>

    <body>
    <!-- The container holds the entire website everything else is 'contained' within the container -->
    <div class="container">
      <div class="header">

        <img src="header.png" alt="logo" width="892" height="142" id="logo" />
    </div>
      <!-- The content divis the Secondary layer which contains the content of the webiste such as text and images.  -->
      <div class="content"> 
        <!-- Navi is what hols the navigation links at the top of the page -->
       <div class="navi">
       <!-- this is the unordered list for the menu items -->
       <ul id="menu">
       <li><a href="\index.html">Home</a></li>
       <li><a href="\trainers.html">Trainers</a></li>
       <li><a href="\order.html" >Order</a></li>
       <li><a href="\credits.html">Credits</a></li>
       <li></li>
       <li></li>
    </ul>
    </div>

    <div class="content"></div>



        <h1>Thank you for your order!</h1>
    <?php

    // sents the value of the items
      $extraValues = array(
          'Laces' => 5,
          'Shoe Polish' => 10,
          'In-souls' => 15
       );

       $trainerValues = array(
          'Lacoste' => 50,
          'K-Swiss' => 45,
          'Puma' => 59,
          'Converse' => 65
       );

       if(isset($_POST['firstname'])){
          $firstname = $_POST['firstname'];
          echo " $firstname ";
       }

       if(isset($_POST['lastname'])){
        $lastname = $_POST['lastname'];
        echo "$lastname <br />\n";
       }

      if(isset($_POST['add1'])){
        $add1 = $_POST['add1'];
        echo "$add1 <br />\n";
      }

     if(isset($_POST['add2'])){
      $add2 = $_POST['add2'];
      echo "$add2 <br />\n";
     }

      if(isset($_POST['postcode'])){
        $postcode = $_POST['postcode'];
        echo "$postcode <br />\n";
      }

      if(isset($_POST['email'])){
        $email = $_POST['email'];
        echo "Contact Email Address $email <br />\n";
      }

      if(isset($_POST['telephone'])){
      $telephone = $_POST['telephone'];
      echo "Contact Telephone Number $telephone <br />\n";
      }

      if(isset($_POST['contact'])){
      $contact = $_POST['contact'];
      echo "You would like to be contacted by $contact <br />\n";
      }

      if(isset($_POST['trainers'])){
      $trainers = $_POST['trainers'];
      echo "The trainers you would like are $trainers <br />\n";
      }



      if(isset($_POST['extras'])){
      $extras = $_POST['extras'];
      echo "The extras you would like are $extras <br />\n";
      }



       $extraCost = 0;
       $trainerCost= 0;
       $totalCost= 0;
       $totalCostV= 0;

        $extra = $_POST['extras'];

        if (array_key_exists($extra, $extraValues)) {
             $extraCost = (float) $extraValues[$extra]; 
            echo "The cost of your extras are &pound; $extraCost<br />\n";
        } 


        $trainer = $_POST['trainers'];

        if (array_key_exists($trainer, $trainerValues)) { 
            $trainerCost = (float) $trainerValues[$trainer]; 
            echo "The cost of your Trainers are &pound; $trainerCost<br />\n";
        }

        $totalCost = round($extraCost+$trainerCost+$totalCost); 
      echo "The cost of your Trainers are (Excluding 20% tax) &pound; $totalCost<br />\n";


      $totalCostV = round(($extraCost+$trainerCost+$totalCost)*1.20,2); 
      echo "The cost of your Trainers are (including 20% tax) &pound; $totalCostV<br />\n";
    ?>
      </div>

      <!-- Holds the foorter information -->
      <div class="footer">
        <p>&#169; 2010 FeetFirst Uk Ltd </p>
        </div>

      </div> 

    </body> 
$totalCost = round($extraCost+$trainerCost); // this line is edited
echo "The cost of your Trainers are (Excluding 20% tax) &pound; $totalCost<br />\n";

$totalCostV = round($totalCost*1.20,2); // this line is edited
echo "The cost of your Trainers are (including 20% tax) &pound; $totalCostV<br />\n";
$totalCost=round($extraCost+$trainerCost);//此行已编辑
echo“培训师的费用(不含20%的税费)£;$totalCost
\n”; $totalCostV=整数($totalCost*1.20,2);//此行已编辑 echo“培训师的费用(包括20%的税费)£;$totalCostV
\n”;
code
$totalCost=round($extraCost+$trainerCost+$totalCost);echo“培训师的费用(不含20%的税费)£;$totalCost
\n”$总成本V=整轮($EXTRAINERCOST+$trainerCost+$totalCost)*1.20,2);echo“培训师的费用(包括20%的税费)£;$totalCostV
\n”;是,但如果
$totalCost=round($extraCost+$trainerCost+$totalCost)=60
,则第二个
$extraCost+$trainerCost+$totalCost将等于120