Jump to content

Archived

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

walnoot

insert into mysql database: everything is in html

Recommended Posts

Hi guys,

I have created a news system based on php and mysql.

now my problem is that when i fill in the form to insert de 'news' into my database, it inserts the text in 'html'-code.

[b]so what I mean is this:[/b]

this is what i type in my form to insert into the database: (for example)
[code]This is my new news post<br>
<br>
<br>
<b>Down down down</b><br>
<br>
<br>
Under :)[/code]

[b]And this is what i get when i read it from the database news table:[/b]
"This is my new news post


[b]Down down down[/b]


Under :)"


[b]NOW what i want to be able to do is i want to type this in my form (you see, without the html codes like '<br>'):[/b]
[code]This is my new news post


Down down down


Under :)[/code]

[b]and i want to get the same out of it:[/b]
"This is my new news post


Down down down


Under :)"

------------------------------------------------------------------------------------------------------------
[b]When I type this in the form now and i read it again from the database, i get this:[/b]
"This is my new news postDown down downUnder :)"

(no '<br>')


[img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /] hope you can help me
thanks

Share this post


Link to post
Share on other sites
Use the nl2br() function to display data back to your page.

[a href=\"http://ca.php.net/manual/en/function.nl2br.php\" target=\"_blank\"]http://ca.php.net/manual/en/function.nl2br.php[/a]

Share this post


Link to post
Share on other sites

×

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.