PDA

View Full Version : When submitting textarea...


SNA
Thu 15th Feb '01, 5:37pm
When submitting textarea into the database then querying it, it shows up with no new lines..

ex...


I submit

1

2

3

4


when i query it , it comes out like

1 2 3 4


How do i get it to print out like i orginally entered it.


PHP(newbie)

SNA
Thu 15th Feb '01, 7:00pm
What I am asking is this,

When you post a reply in the <TEXTAREA> it gets put into the database.

When I want to Show what you replyed, I just pull out the data from the database....

That is basic obviously...

I am having a problem pulling the data FROM the database AS it was submitted.


Another example.

In a <TEXTAREA> I post and it gets stored in the database as:

Hi

My

Name

Is

SNA


When I pull the data FROM the database and show it,


print("$array[somenumber]");


It shows up as

Hi My Name Is SNA


I DONT WANT IT TO DO THIS,


I want it to show

Hi

My

Name

Is

SNA


How can I fix it?

Again i am a newbie to PHP,

thanks

Mike Sullivan
Thu 15th Feb '01, 7:05pm
print("$array[somenumber]");

That code is right but you failed to account for the fact that the default content-type is text/html.

print(nl2br("$array[somenumber]"));

SNA
Thu 15th Feb '01, 7:10pm
Thanks Ed,

It worked liked a charm...


Where did you get that information from?

The nl2br code. Which book or link do you recommend

Mike Sullivan
Thu 15th Feb '01, 7:31pm
www.php.net :)