/*user is filing up form values that includes name , phone , product quantity...etc */<BR/>
/*After clicking button */
$mailto = randomuseremail@xxx.com
/* *//
$value1=$_GET['value1'];
$value2=$_GET['value2'];
$value3=$_GET['value3'];
.
.
.
$value20=$_GET['value20'];
$message = <<< EOD
< br> value 1 is: $value1;
< br> value 2 is: $value2;
< br> value 3 is: $value3;
.
.
.
< br> value 20 is - $value20;
... EOD ;
$success = mail($mailto, $message , $body, $headers);
用户收到此电子邮件
You orderd:
value 1 is: 1
value 2 is: 0
value 3 is: 0
...
value 20 is: 0
而不是显示如何过滤/不显示0或“”值白色EOD(或者有更好的方法) 这是所需的电子邮件输出:
You orderd:
value 1 is: 1 /*or any other non zero | "" value */
答案 0 :(得分:0)
$message = '';
for ($i = 1; $i <= 20; $i++) {
if ($_GET['value'.$i] != 0) {
$message .= "<br> value $i is: " . $_GET['value'.$i]
}
}