Problem in fetching data from text area.... When i enter some text in textarea like: Hi this is text message thanks but i try to fetch it using post method i get this text in one line.. how can i fix it it? ere is my code thank you if(isset($_POST["submit"])) { echo $_POST["shortDesc"]; exit; } PHP: <textarea name="shortDesc" cols="60" rows="4" id="shortDesc"></textarea> <br/> <input name="submit" type="submit" id="submit" value=" Submit " /> Code (markup):
change this echo $_POST["shortDesc"]; to echo nl2br($_POST["shortDesc"]); it will convert linebreaks to <br>
why do you need to use preg_replace if PHP have an easy built-in function can do this with 5 characters