...

View Full Version : Textarea Problem



deshi2003
03-12-2009, 10:57 AM
in my blog site when user write a blog they can write in text area as their will
that is they can give space, new line any other alignment. but when i post the blog from database in my website i can maintain user newline useng nl2br() function,but the alignment that is apace is lost.every line is started from begining. how could i solve this problem. i am giving here an example.(i used html textarea tag)

user input:

hi, i wanna do something with you
how about you.do you want to share some thing withme


mysite output:
hi, i wanna do something with you .
how about you.do you want to share some thing withme.

phantom007
03-12-2009, 11:09 AM
I suggest you to use a Rich textbox instead.

A free and open-source WYSIWYG editor can be found on http://www.openwebware.com/


Thanx

tosbourn
03-12-2009, 11:50 AM
I am not sure if this will work, but you could try


str_replace('','$nbsp;',$input)

Rowsdower!
03-12-2009, 04:17 PM
in my blog site when user write a blog they can write in text area as their will
that is they can give space, new line any other alignment. but when i post the blog from database in my website i can maintain user newline useng nl2br() function,but the alignment that is apace is lost.every line is started from begining. how could i solve this problem. i am giving here an example.(i used html textarea tag)

user input:

hi, i wanna do something with you
how about you.do you want to share some thing withme


mysite output:
hi, i wanna do something with you .
how about you.do you want to share some thing withme.


Hello and welcome to the forums! It helps to put this in a "code" block for the forums. That way we can see that you are trying to preserve the whitespace:
user input:

hi, i wanna do something with you
how about you.do you want to share some thing withme


mysite output:
hi, i wanna do something with you .
how about you.do you want to share some thing withme.

As for the HTML output you just need to use white-space:pre; for the style when you present the user's input on the page. This will ensure that the web page displays all of those times that the user pressed the space bar. This way you don't have to mess with your other coding! :thumbsup:

deshi2003
03-12-2009, 05:07 PM
ok, i wanna say that what about htmlencode() or htmldecode()



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum