Formatting submitted Data from a field

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
oscardog
Forum Contributor
Posts: 245
Joined: Thu Oct 23, 2008 4:43 pm

Formatting submitted Data from a field

Post by oscardog »

So i've got somewhere, a textfield, where people can write asmuch as they want currently, i will put a limiter of 10,000 characters on though. Now if they put a new paragraph, when its then displayed, i want to display it exactly as they wrote it. It submits into a MySQL database, so say i write:

'My Name is Ashley

And Im 17

And i love this website'

I want it to appear like that, but it appears as :My Name is Ashley And Im 17 And i love this website.

Im assuming i need to add \n to signify a newline each time they hit enter, but when it submits how do i put those \n's in before it submits, and how can i tell where to put them?

Complex, i know, but any help?
Cirdan
Forum Contributor
Posts: 144
Joined: Sat Nov 01, 2008 3:20 pm

Re: Formatting submitted Data from a field

Post by Cirdan »

If you are allowing them to use HTML, you could use something like FCK Editor to help format your users posts.But be careful, allowing all HTML is dangerous.
oscardog
Forum Contributor
Posts: 245
Joined: Thu Oct 23, 2008 4:43 pm

Re: Formatting submitted Data from a field

Post by oscardog »

I am using a normal textfield... any ideas?
Post Reply