Alanay Posted December 18, 2014 Share Posted December 18, 2014 I need to put this inside of a p tag so I can change some properties but everything I've tried doesn't work and just shows nothing. I've tried this: printf('<p style="text-align: left; width: 500px;">', htmlspecialchars($fetch['shout'], ENT_QUOTES, 'UTF-8'), '</p>'); This is what I need to be wrapped in p tags: htmlspecialchars($fetch['shout'], ENT_QUOTES, 'UTF-8'); EDIT: I've noticed the code below works but when I style it inside of the tag the text won't show, should I include a CSS file on the PHP file? echo "<p>".htmlspecialchars($fetch['shout'])."</p>\n"; EDIT: I just needed to create the CSS for the p tags in the index and it worked perfectly fine. Sorry for the pointless thread. Link to comment https://forums.phpfreaks.com/topic/293165-how-do-i-concatenate-htmlspecialchars/ Share on other sites More sharing options...
Barand Posted December 18, 2014 Share Posted December 18, 2014 If you are going to use printf(), use it correctly with %s placeholder for the string argument. printf('<p style="text-align: left; width: 500px;">%s</p>', htmlspecialchars($fetch['shout'], ENT_QUOTES, 'UTF-8')); Link to comment https://forums.phpfreaks.com/topic/293165-how-do-i-concatenate-htmlspecialchars/#findComment-1499989 Share on other sites More sharing options...
Alanay Posted December 18, 2014 Author Share Posted December 18, 2014 If you are going to use printf(), use it correctly with %s placeholder for the string argument. printf('<p style="text-align: left; width: 500px;">%s</p>', htmlspecialchars($fetch['shout'], ENT_QUOTES, 'UTF-8')); Thank you, works perfectly. Link to comment https://forums.phpfreaks.com/topic/293165-how-do-i-concatenate-htmlspecialchars/#findComment-1499990 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.