Jump to content

How do I concatenate htmlspecialchars? :/


Alanay

Recommended Posts

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.  :sweat:

 

Sorry for the pointless thread.

Link to comment
https://forums.phpfreaks.com/topic/293165-how-do-i-concatenate-htmlspecialchars/
Share on other sites

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'));

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.