系统默认打印,否则在php中输出消息

时间:2017-09-04 11:24:22

标签: php

我编写这些代码用于搜索项目中的功能。     如果用户输入正确的邮政编码,如果邮政编码错误则显示一个表格,它会显示我在其他情况下写的一些信息。     但默认情况下,当用户在页面上第一次输入时显示else消息。     如果用户输入错误的邮政编码,我想表明(我在其他情况下写的消息)消息,我有什么建议。

<small>Enter your zipcode to book our service</small>
    <?php if($this->isAllowedZipcode=="Matched"){?>  
    <div class="row">
    </div>
    <?php } ?>
    <?php } else
    { ?>
        <div class="row">
            <div class="col-sm-12 col-xs-12">
                <p>Sorry but our services are not available in your area. We are working hard to cover as much area as we can. Thank you for using the system.</p>
                    <?php } ?>

2 个答案:

答案 0 :(得分:0)

您的代码似乎不正确/不完整,但根据您的要求,您可以按照以下方式执行:

Dim summary =
    text.Split({Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries).
         Select(AddressOf Integer.Parse).
         GroupBy(Function(value) 1).
         Select(Function(group) (Min:=group.Min(), Max:=group.Max())).
         DefaultIfEmpty((Min:=0, Max:=0)).
         First()

Dim minValue = summary.Min
Dim maxValue = summary.Max

答案 1 :(得分:-1)

如果您可以测试是否设置了邮政编码,则可以使用elseif条件,而不仅仅是else

<small>Enter your zipcode to book our service</small>
    <?php if($this->isAllowedZipcode=="Matched"){?>  
    <div class="row">
    </div>
    <?php } elseif (isset($inputZipCode))
    { ?>
        <div class="row">
            <div class="col-sm-12 col-xs-12">
                <p>Sorry but our services are not available in your area. We are working hard to cover as much area as we can. Thank you for using the system.</p>
                    <?php } ?>