#1
  1. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    5
    Rep Power
    0
    how to prevent html input of form
  2. #2
  3. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,648
    Rep Power
    4493
    PHP offers a couple function that will help you.

    One is strip_tags($string). This attempts to remove all HTML and PHP tags from a string.

    Another options is htmlspecialchars($string) which will turn special html characters like < and > into < and > (or something like that).

    I like to use the second option,that way if someone want to write some code as an example, say <img src="pic.jpg">, then it shows up just as the person types it, it's not stripped, and it's not evaluated as html.

    ---John Holmes...

    ------------------
    *************************************************************
    * The manual can probably answer 90% of your questions...
    *
    * PHP Manual. www.php.net/manual
    * MySQL Manual: www.mysql.com/documentation/mysql/bychapter
    *************************************************************
  4. #3
  5. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    5
    Rep Power
    0
    do you mean ;
    if(ereg(htmlspecialchars($string)){echo" no html input please";} it will against html input
    i will try it
    thanks
  6. #4
  7. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,648
    Rep Power
    4493
    No...just something like this:

    $string = htmlspecialchars($string);
    or
    $string = strip_tags($string);

    This will make it so the html tags have no effect, so you don't really have to tell the person to not use html tags. They just won't work.

    ---John Holmes...

    ------------------
    *************************************************************
    * The manual can probably answer 90% of your questions...
    *
    * PHP Manual. www.php.net/manual
    * MySQL Manual: www.mysql.com/documentation/mysql/bychapter
    *************************************************************

Similar Threads

  1. How to get client email??Help plz
    By Gecko22 in forum ASP Programming
    Replies: 12
    Last Post: January 22nd, 2004, 02:40 PM
  2. not returning records when it should
    By aliaga61 in forum ASP Programming
    Replies: 3
    Last Post: January 16th, 2004, 11:57 AM
  3. 'Object required' error
    By aliaga61 in forum ASP Programming
    Replies: 1
    Last Post: January 16th, 2004, 09:48 AM
  4. saving input from html
    By struwelmann in forum Perl Programming
    Replies: 3
    Last Post: December 29th, 2003, 12:04 AM

IMN logo majestic logo threadwatch logo seochat tools logo