I was hoping I could get some help from you guys. The code below works but I doubt that this is a good way to write the syntax. Especially since it will require an enormous amount of code.
The thing I’m trying to do is create a list which will be populated only if an item has a value. I have already specified if the variable has a value or not (I think that part of the code could use some work as well, but that’s a different question). And I’ve found a way to show or hide the item in the list. But I don’t think it’s efficient. And that’s where I could use some help.
<?php
if(empty($orderNum))
{
echo "<li><a href='#' title='Brodit'>Tomte</a></li>";
}
else
{
echo "<li><a href='unordered.php?SupName=2&SupStatus=3' title='Brodit'>Order ("; echo "$orderNum"; echo ")</a></li>";
}
?>
You can use
"foo {$var} bar"instead of"foo ".$var." bar". This is (in my opinion) more elegant.If the HTML Code gets longer I would prefer: