-3

我为我的 php 类做这个项目,我已经包含了代码。我无法弄清楚语法错误是什么。我已经改变了很多次,但没有任何效果。有人能帮我吗。谢谢!

<title>ordering form</title>
</head>

<body>


<h1>Welcome  <?php echo $_POST['firstname']; ?> </h1>

<?php
if($_POST['sport'] == "gymnastics" && $_POST['gender'] == "men")
{
echo "You do not fit your category";
}
elseif($_POST['sport'] == "football" && $_POST['gender'] == "women")
{
echo "You do not fit your category";
}
else
{
echo "You fit your category"; 
}
?>
<?php
$mugcost = 4.95;
$taxrate = .08;
$mugcost = $mugcost * $_POST['quantity'];
$tax = $mugcost * $taxrate;
$mugcost = $mugcost + $tax;
$shipping = 5.99;
$finalcost = $shipping + $mugcost;
?>
<?php
echo "Your total cost is," $finalcost;  
?>


</body>
</html>
4

3 回答 3

0

忘记正确连接这一行(现在有了一个全新的.):

<?php
echo "Your total cost is," . $finalcost;  
?>
于 2013-09-27T18:51:58.130 回答
0

您缺少字符串连接运算符 ( .)

<?php
    echo "Your total cost is," .$finalcost;  
                               ^
?>
于 2013-09-27T18:52:07.773 回答
0

在你最后echo你错过了一个时期:

echo "Your total cost is,". $finalcost;
                          ^^
于 2013-09-27T18:52:47.173 回答