Reputation: 41
Can anyone please help with this. For some or other reason the !empty()
in view.ctp does not seem to work.
I have 4 records where 'occupation' has text and another 2 records where there is nothing at all. If I use !empty()
as below they all disappear and if I use empty()
they all come back. What am I doing wrong?
Your help will be greatly appreciated.
<?php if (!empty($shoulderExamination['occupation'])):?>
<dt><?php echo __('Occupation'); ?></dt>
<dd>
<?php echo h($shoulderExamination['ShoulderExamination']['occupation']); ?>
</dd>
<?php endif; ?>
Upvotes: 0
Views: 900
Reputation: 1289
Try
if (!empty($shoulderExamination['ShoulderExamination']['occupation']))
instead of
if (!empty($shoulderExamination['occupation']))
Upvotes: 1