Jump to content

Recommended Posts

Using any *very* compatible scripting (javascript,php, etc) what would be the easiest way to completely disallow html input from being entered into an html form?

 

I do not want to strip html tags, or re-encode them for a database, or allow only certain tags...I want the textbox to throw away the entire form if any html tag is entered from any source.

 

I suppose I could regex or use some part of an existing php function to detect tags, but I don't think I could account for  all possible tags - I basically want the textbox to be TRULY text only. I'd probably want to allow someone to use <> and other english language characters as they would in an actual english sentence, but I want the form to just deny any programming tags.

 

Does any one know of snippets out there that already do this? Thanks!

Link to comment
https://forums.phpfreaks.com/topic/56716-textbox-disallow-html-input/
Share on other sites

  • 4 weeks later...

you can't restrict them from entering html tags but you can filter the html out when you submit a form. Using javascript might seem like a solution to prevent a person from entering html into a textarea but you can always disable javascript

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.