user570288
user570288

Reputation: 31

Keeping standard text formatting

I have a site that is using a textbox like the one I entered the text in here, I would like to keep the standard text formatting. For instance the spacing, the line breaks, but not extra formatting like Bold or Italic formatting. What would be the best way to do this using xhtml and PHP?

Upvotes: 0

Views: 407

Answers (2)

Flambino
Flambino

Reputation: 18773

Use a <pre> element around the text. This will maintain the existing formatting.

Upvotes: 0

Alexander Varwijk
Alexander Varwijk

Reputation: 2083

Use the <pre></pre> tags to keep normal formatting, as in, it will preserve any linebreaks (\n) and whitespace entered in the textarea.

Upvotes: 2

Related Questions