开发者

How to output multiple line mysql string from database without quotes

开发者 https://www.devze.com 2023-01-31 17:57 出处:网络
I\'m retrieving a string from a database that was entered by a form, but if the string is to long, it\'s generated with double quotes in the html.

I'm retrieving a string from a database that was entered by a form, but if the string is to long, it's generated with double quotes in the html. This is how I'm retrieving the data:

echo '<p>' . $descr['field_value'] . '</P>';

When I view the html source, the browser adds double quotes.

short single line strings do not show up with quotes.

Is there a way to force php t开发者_C百科o display strings without quotes?


You should use echo '<p>' . htmlspecialchars($desc['field_value']) . '</p>';.

See http://php.net/manual/en/function.htmlspecialchars.php for more details.

0

精彩评论

暂无评论...
验证码 换一张
取 消