Jon Perron
Jon Perron

Reputation: 75

How to stop text boxes from interpreting information entered as HTML

I'm fairly new to html and php and have an issue where I can type html into my text box and if I echo out the information from the database it will actually run the code. What I mean is...

On my website there is a textbox and in the text box they can type br or a href etc and the code will run like actuall html.

So is there a way to prevent this? CKEditor or what? All support is much appreciated!

Upvotes: 1

Views: 161

Answers (1)

Niet the Dark Absol
Niet the Dark Absol

Reputation: 324780

htmlspecialchars would be a good place to start. Followed by getting a clue what you're doing before you become yet another victim of terrible coding practices and security issues.

Upvotes: 2

Related Questions