Reputation: 93
I know this question in some form has been asked before, but somehow it still goes wrong in my case...
I want to show some HTML if a certain database field is NOT empty. So after following numerous options I got the following code:
<?
if ($remark!=="")
{
echo "<tr class=\"warning\"><td colspan=\"5\">REMARK: $item->remark </td></tr>";
}
?>
But the code is generated in every case, also if the field is empty. Also, I got the following message: Notice: Undefined variable: remark in...
If the field is empty, nothing needs to happen.
Upvotes: 1
Views: 71
Reputation: 27092
You used undefined variable in condition.
if ($item->remark !== "")
Upvotes: 1