Results 1 to 3 of 3

Thread: html tag filter

  1. #1
    Join Date
    Feb 2005

    html tag filter

    Hi all,

    I come from a PHP background and am just starting to code ASP pages. My current problem is this:

    I have a textarea form in which users can enter info about themselves, in this case a short cv or resume. This info is simply held in a varchar field in a table. Some of the more crafty users have been entering html code in the form to play with their fonts, creating tables etc which are stored in the database. What is the best way to filter html code out of the inputted user form data?

    Many thanks in advance...

  2. #2
    Join Date
    Jan 2004
    Melbourne, Australia
    Replace < and > with their ascii equivelants.
    strContent = Replace(strContent, "<", "&lt;")
    strContent = Replace(strContent, ">", "&gt;")
    strContent refers to a variable that holds the value of the textarea. This should actually just print the HTML to the page.

    There is also a handy funtion available at 4guysfromrolla.com that will solve your problem. See it here: http://www.4guysfromrolla.com/webtech/073000-1.shtml


  3. #3
    Join Date
    Feb 2005
    That link is exactly what I was after, thanks!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center