Jump to content


Photo

help with textarea


  • Please log in to reply
4 replies to this topic

#1 brown2005

brown2005
  • Members
  • PipPipPip
  • Advanced Member
  • 943 posts

Posted 22 September 2006 - 01:02 PM

hi,

i have a text field where people will write there comments...

i want to be able to say write text like,

hello hello

hello hello


keeping spaces in it....

which form field type should i use input or textarea or neither?

and how do i keep it with spaces..

#2 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 22 September 2006 - 01:03 PM

textarea... and when you display the text from the database, wrap it in the function nl2br().

Info: PHP Manual


#3 AdRock

AdRock
  • Members
  • PipPipPip
  • Advanced Member
  • 911 posts

Posted 22 September 2006 - 01:05 PM

Yes.

here is how i display paragraphs

echo nl2br($code['content'])
If your topic has been solved, please mark the topic as SOLVED.

This helps others from identifying which topics need help still

#4 brown2005

brown2005
  • Members
  • PipPipPip
  • Advanced Member
  • 943 posts

Posted 22 September 2006 - 01:08 PM

but how do i insert it into the database, cause it puts it together if i just have...

$comment  = $_POST['comment'];

#5 brown2005

brown2005
  • Members
  • PipPipPip
  • Advanced Member
  • 943 posts

Posted 22 September 2006 - 01:19 PM

ignore the last comment...

it does work

thanks all for your help....




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users