justins;10998851 wrote:2)Display that text exactly as it was entered in page 1 (with line breaks, quotes etc) on page 2
For that, you'd want to use something like [man]nl2br/man to translate literal line breaks into the HTML '<br>' entity. Otherwise, data like this:
Line 1
Line 2
Line 3
if directly echo'd into an HTML document is going to look like this when rendered (e.g. by your web browser):
Line 1 Line 2 Line 3
justins;10998851 wrote:3)Email that text, with quotes, line breaks etc
Again, you've gotta be careful about what you mean by "line breaks." If the e-mail is sent as an HTML document, the same issue above applies. Otherwise, you'd want to simply use the POST'ed data as-is (e.g. with normal CRLF/LF line break characters).
justins;10998851 wrote:4)Escape the text and add it to a database
To do this, you'd simply use the string escaping function provided by the PHP extension you're using or use prepared statements.
Note that if you store the data in the DB as-is without converting line breaks (this would be my preference), you'll want to again use [man]nl2br/man every time you retrieve the data and insert it into an HTML document.