Jump to content

htmlentities


chriscloyd

Recommended Posts

I have a form and i enter the info into a mysql database

say this is the text i wrote

[quote]Hi, how are you today?

From Chris[/quote]

but when i display it from the mysql db it shows up like

[quote]Hi, how are you today?From Chris[/quote]

how do i make it show up like

[quote]Hi, how are you today?

From Chris[/quote]

Link to comment
https://forums.phpfreaks.com/topic/27845-htmlentities/
Share on other sites

use nl2br() http://php.net/nl2br

so like this:

[code]$message = nl2br($_POST['my_message']);
$sql = mysql_query("INSERT INTO db_table(`message`)VALUES('$message')");[/code]

Then when you display it:

[code]$sql = mysql_query("SELECT * FROM db_table");
$row = mysql_fetch_array($sql);

echo $row['message'];[/code]

Hope this helps
Link to comment
https://forums.phpfreaks.com/topic/27845-htmlentities/#findComment-127375
Share on other sites

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.