Write html code in form, save it to the database after submission, and read it again. will these html code take effect? For example, enter the following code in the form: Red
The text field that is saved to the mysql database after submission. Then read the code and return it to the user using echo. why is the code not executed?
The returned statement is:
$ Arr [txt] = str_replace ('','', $ arr [txt]);
$ Text = nl2br ($ arr [txt]);
Echo"
$ Cno: $ text ";
The code was not executed. it only showed the word "red", but the font was not red.
What is the reason?
Reply to discussion (solution)
View the source code.
View the source code.
View source code? How to view it?
Right-click the browser to view the source file.
$ Arr [txt] = str_replace ('','', $ arr [txt]); // The problem lies in this sentence.
What is red? View source code by yourself
Browser -- right-click to view webpage source code
$ Arr [txt] = str_replace ('','', $ arr [txt]); // The problem lies in this sentence.
What is red? View source code by yourself
Oh, it turns out that this statement removes spaces in the code. Is that the original code?