[My EDITED New Question]
I am taking text input in HTML form as . Suppose the user entered the following text:
Spaces and punctuation are preserved.
If you're not seeing them, then you're probably outputting the text in an HTML document and forgetting to mark it up as HTML: remember, web browsers ignore newlines and consecutive spaces in plaintext.
As for formatting like bold, you need to come up with some way of marking-up your text to store the formatting information. You might consider HTML or Markdown.