I input some text in <textarea></textarea>
, I enter some line breaks, spaces,etc. purposely. However, after the text is submitted and rendered within <pre></pre>
, the newline, whitespaces are gone, they are replaced by something like \r\n\r\n
, what's wrong? How can I keep the original format?
<textarea name="detail" id="detail" rows="7" cols="60" style="font-family:Arial, Helvetica, sans-serif"><?php echo $detail ?></textarea>
I render the text in HTML.
This is the output:
The urban agglomeration of the Hangzhou metropolitan area (杭州市区) has a resident population of 3.9319 million as of 2003, of which 2.6367 million ...\\\\r\\\\nHangzhou is located in northern Zhejiang province, eastern China, at the southern end of the Grand Canal of China, on the plain of the mid ...\\\\r\\\\nIn late summer (August to September), Hangzhou, along with other cities in Zhejiang province, suffer typhoon storms, but typhoons seldom strike it directly. Generally. Edited\r\n\r\nAnother line.
The data-type is varchar(MySQL), does it have anything with the problem?