试图创建一个2步代码“if语句” [英] trying to create a 2 step code "if statement"
本文介绍了试图创建一个2步代码“if语句”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试向以下代码添加if语句,只需要澄清它是否能做正确的工作。
i am trying to add a if statement to the following code, just need clarification to see if it will do the right job.
Order #: <? echo $ORDERID?><br />
<br />
Pick-Up Date: <? echo $MYPICKUP?><br />
Comments: <? echo $COMMENTS?><br /><br />
<? echo $CART?><br />
Order total: $<? echo $GRANDTOTAL?><br />
Payment Method: <? echo $PAYMETHOD?></span><span class="TextB"><br />
尝试添加Shipping&处理:在那里结果是:
trying to add Shipping & Handling: in there with the result being :
<?php
$paypal = 'paypal';
$check = 'check';
if ($paymethod == $paypal)
{
echo "Shipping & Handling = $GRANDTOTAL * .045";
}
elseif ($paymethod == $check)
{
echo "Shipping & Handling = 0";
}
?>
但我的问题是,选择该选项后是否会显示运费和处理金额?
but my question is, will the shipping and handling amount show up when the option is chosen?
推荐答案
确保 $ paymethod
不是 $ PAYMETHOD
,区分大小写。
并确保 $ paymethod
必须等于 paypal
或检查
,它也区分大小写。
make sure $paymethod
is not $PAYMETHOD
, it is case sensitive.
and make sure the $paymethod
must equals paypal
or check
, it is also case sensitive.
这篇关于试图创建一个2步代码“if语句”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文