<form > <td> <textarea name="specification" cols="30" rows="20" ></textarea> </td> <tr> <td><input type="submit" name="submit" value="ADD"></td> </tr> </form> this is my form field and it takes input succesfully. but when displaying the result, the result contains many html special charachters like \nl,<br /> tags Which i donot want to display in the result page. my output code is as follows <tr> <td><?php echo $specification; ?></td><td><?php echo (strtoupper(trim($model_by_id['specification']))) ;?></td> </tr> can anyone tell me that how to avoid displaying the html \nl,<br />,\r tags in the output. suppose if i give input like: INPUT: a quick brown fox jumps over the lazy dog. Output: a quick brown fox\nl jumps over the lazy dog. The thing is I donot want the \nl tag to showup. As it looks unusual
nl2br is a function to rename the \n to br but you can also remove them by using str_replace("\n", "", $str)
There is another problem. What ever i give input in the text area aforementioned the output always shows something like, if I give input like INPUT : specification : dsgnx price : sdubsd output gives result like this : specification : dsgnx\r\n price: sdubsd\r\n how can i remove these \r\n tags
There is another problem. What ever i give input in the text area aforementioned the output always shows something like, if I give input like INPUT : specification : dsgnx price : sdubsd output gives result like this : specification : dsgnx\r\n price: sdubsd\r\n how can i remove these \r\n tags
I wrote a "praragraphization" function that turns all \r\n's (and all their combos) into <p></p> - just change what you want the code to do below: /*** PARAGRAPHIZE ***/ function paragraphize($string, $delimit = "\\r\\n") { $paragraphs = explode($delimit, $string); for($i = 0; $i<sizeof($paragraphs); $i++) { if($paragraphs[$i]) $paragraphs[$i] = '<p>'. $paragraphs[$i] .'</p>'; else $paragraphs[$i] = ""; } return implode('', $paragraphs); } Code (markup): Ultimately all you have to do is remove the <p></p> parts and you should have it how you want it.