php - 我无法让我的 php 添加我需要添加的所有内容
问题描述
我正在尝试将 if 语句添加到 the$totalReimb
以及 the$totalMileReimb
但似乎无法让它们仅$totalMileReimb
添加
变量
$ratePerMile = 0.35;
$miles = $_POST['miles'];
$bfast = $_POST['bfast'];
$lunch = $_POST['lunch'];
$dinner = $_POST['dinner'];
$hotel = $_POST['hotel'];
$totalMileReimb = $miles * $ratePerMile;
$totalReimb = 0 + $totalMileReimb;
$Yes = "Yes";
$No = "No";
If 语句
if ($miles < 1 or $miles > 3000){
// input error message
print ("<p> Input Error, Try Again! </p>");
// link back to the form
print ("<a href=\"juarez-biz-travel.html\">Return to form</a>");
} else {
if ($miles >=10 or $miles <= 3000 );{
if ($bfast == $Yes) $totalReimb + 8.50;
if ($lunch == $Yes) $totalReimb + 12.50;
if ($dinner == $Yes)$totalReimb + 18.50;
if ($hotel == $Yes) $totalReimb + 110.00;
}
print ("<p> The Total Is $$totalReimb! </p>");
}
解决方案
我认为你的错误是这样的,$totalReimb + 12.50
应该是以下之一:
$totalReimb = $totalReimb + 12.50
$totalReimb += 12.50
.
推荐阅读
- java - 使用 StandardXYToolTipGenerator 格式化工具提示值
- javascript - createStore 不会从初始状态更改为 Action 证明值
- cordova - 有没有办法使用 Ionic 3 在浏览器中捕获音频
- spring - 在 Spring AOP 中使用 Aspects 条件执行方法
- php - htmlentities 无法将 HTML 实体转换为字符
- cryptography - 无法创建名称为“http://www.w3.org/2000/09/xmldsig#hmac-sha1”的算法
- c# - Activator.CreateInstance 期间的 MissingMethodException
- excel - 将散点图上的点与系列间隙连接起来
- python - Python图像抓取返回HTML
- c# - 如何切换字典中所有值的顺序并反转顺序?