1

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.

1
  • 2
    You need to show the origin/assignment of $remark Commented May 18, 2015 at 15:25

1 Answer 1

1

You used undefined variable in condition.

if ($item->remark !== "") 
Sign up to request clarification or add additional context in comments.

1 Comment

This was the correct solution for me. (I hope this won't be deleted, as I think it is very usefull for the community to know whether an answer was correct or solved the problem.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.