Advertisement
arsh999cg

Output field only if it is not emtpy

Feb 25th, 2024
666
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.42 KB | None | 0 0
  1. <?php
  2. if( $location ): ?>
  3.     <?php echo !empty($location['street_name']) ? esc_attr($location['street_name']) : ''; ?> &nbsp;
  4.     <?php echo !empty($location['street_number']) ? esc_attr($location['street_number']) : ''; ?> <br />
  5.     <?php echo !empty($location['post_code']) ? esc_attr($location['post_code']) : ''; ?> &nbsp;
  6.     <?php echo !empty($location['city']) ? esc_attr($location['city']) : ''; ?><br />
  7. <?php endif; ?>
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement