How can I hide a specific field on a page displaying data from a form if no value is submitted? An example is below:
<?php if($price): ?>
<li><?php echo $price;?>: <?php echo get_property_price($post->ID);?> <?php echo get_post_meta($post->ID,'rentperiod',true);?></li>
<?php endif; ?>
I don't want the $price
or rentperiod
values to display as a list item if they are empty. What's the best way to accomplish this?