Found a weird bug and don't know how to solve it_PHP Tutorial

WBOY
Release: 2016-07-20 11:15:06
Original
772 people have browsed it

In textarea, rn is used for line breaks (the same is true for ckeditor), but str_replace() cannot be used to process rn. I don’t know why.

// Line breaks in textarea use rn, and they cannot be removed using the str_replace method! !
//The test1 table has only two fields, id and textarea, and only one record with id=1.
require_once 'connect_text.php';
require_once 'show_message.php';
if($_POST['text']){
$text = str_replace('rn', '', $ _POST['text']);      //Tried to remove it, but the test result was not removed rn
$query="UPDATE test1 SET textarea = '$text' WHERE id = '1'";
$result = mysql_query($query);
if($result){
echo "<script>alert('It's done!')</script>";
}
}
$query = "SELECT textarea FROM test1 WHERE id = '1'";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
?> ;



//Try to remove it, but the test result is not removedrn


 
< /div>


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/440218.htmlTechArticletextarea uses rn for line breaks (same for ckeditor), but str_replace() cannot be used to process rn. I don’t know. Why. ?php // Use rn for line breaks in textarea, and use str_repl...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template