Are you first timer at Why not join us and start exchange your programming knowledge with everyone. Register today!

PHP - Show/hide value for multiple datas

0 votes
added Mar 27, 2018 in PHP by LC Marshal Captain (22,730 points)
​//Show/hide values for multiple lines
<?php if(
    empty($profile->field_address_line_1->value()) &&
    empty($profile->field_address_line_2->value()) &&
    empty($profile->field_zip->value()) &&
    empty($profile->field_area->value()) &&
): ?>     
<div class="_row">
      <i class="fa fa-map-marker" aria-hidden="true"></i>
      <?php if(!empty($profile->field_address_line_1->value())): ?>
        <?php print $profile->field_address_line_1->value(); ?>
      <?php endif;?>
      <?php if(!empty($profile->field_address_line_2->value())): ?>
        <?php print $profile->field_address_line_2->value(); ?>
      <?php endif;?>
      <?php if(!empty($profile->field_zip->value())): ?>
        <br/> Postal Code:
        <?php print $profile->field_zip->value(); ?>
      <?php endif;?>
      <?php if(!empty($profile->field_area->value())): ?>
        <?php print area_id_to_name($profile->field_area->value()); ?>
      <?php endif;?>
      <?php if(!empty($profile->field_state->value())): ?>
        <?php print state_id_to_name($profile->field_state->value()); ?>
      <?php endif;?>
<?php endif;?>

Please log in or register to response this reference. - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.