[英]PHP “if empty” help Joomla - VirtueMart
I'm having trouble with this code. 我在使用此代码时遇到麻烦。 If the field
customer_note
is empty, need it to return a value of N
and Y
if there is text in the field. 如果字段
customer_note
为空,则如果字段中有文本,则需要它返回N
和Y
的值。 The resulting Y
or N
is being passed into an XML line. 所得的
Y
或N
将传递到XML行中。 I'm using PHP 5.2.9. 我正在使用PHP 5.2.9。
Thank you. 谢谢。
if( !empty( $customer_note )) {
$shopper_message .= $customer_note."\n";
} else {
$shopper_message .= "\n";
}
I'm not sure if you want this: 我不确定您是否要这样:
< ?php
function check_ifempty($customer_note)
{
if (empty($customer_note))
{
return "N";
}
else
{
return "Y";
}
}
?>
< ?php
$customer_note = $_POST["customer_note"];
$result = check_ifempty($customer_note);
$xml .= $result;
?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.