Reputation: 22674
Just wondering, what is the correct way to add HTML <strong>
tags or anything else for that matter to this?
echo $row->title
I did this
echo '<strong>'.$row->title.'</strong>';
Upvotes: 0
Views: 9989
Reputation: 512
There is no wrong or correct way to do it. Do it like it is best readable for you (and this is a subjective question). But try to develop a standard and don't do it in a different way everytime.
Upvotes: 1
Reputation: 318468
The way you are doing it is perfectly fine. However, don't forget that you might need to escape html characters unless HTML should be allowed (which is unlikely in a "title").
echo '<strong>'.htmlspecialchars($row->title).'</strong>';
This would escape <> and some other special characters.
Upvotes: 1