fuction to remove tags

Discussion in 'PHP' started by promotingspace.net, Jul 17, 2007.

  1. #1
    Hi
    How do you think if I define a function like this:
    function m($variable){
    $variable=addslashes($variable);
    $variable=strip_tags($variable);
    $variable=mysql_real_scape_string($variable);
    return $variable;
    }
     
    promotingspace.net, Jul 17, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    You don't need addslashes() if you're already using mysql_real_escape_string(). And maybe you want to use trim() as well. Aaaand I would use htmlsecialchars() instead of strip_tags()... but that's just me. :) It also depends on what you want to do with the variable.
     
    nico_swd, Jul 17, 2007 IP
  3. LosNir

    LosNir Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    right, and you can also use stripslashes (but before mysql_real_escape_string() if you use it).
     
    LosNir, Jul 17, 2007 IP