NewUser
NewUser

Reputation: 3819

How to take multi line input form user and show the same in PHP

I have searched many articles but I could not find one appropriate. I am trying to take input form user a multiple line text and show them as it is. I am using textarea tag, but the page is not working the input values are showed in one line even it I press enter an start a new line.
Please help me fixing this.

Upvotes: 2

Views: 529

Answers (2)

Serge
Serge

Reputation: 1601

Already mentioned nl2br() is one way;

another way is to echo the output within <pre> .. </pre> HTML tags.

Upvotes: 2

John Conde
John Conde

Reputation: 219834

Use nl2br() when echoing the output.

Upvotes: 7

Related Questions