Write html code in form, save it to the database after submission, and read it again. will these html code take effect?

Source: Internet
Author: User
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?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.