Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Form Data PHP

Options
  • 22-07-2009 3:29pm
    #1
    Closed Accounts Posts: 2,828 ✭✭✭


    I am just wondering how would you strip form input of slashes, hypens, brackets, html tags, quotations and just have the raw text left over. Is there a PHP function to accomplish this, I am wanting to make the data safe to use in a database.

    Thanks


Comments

  • Registered Users Posts: 3,745 ✭✭✭laugh


    A combination of htmlentities, strip_tags and any other functions or custom code as filters first and then mysql_real_escape_string when inserting.

    I would read the pages on php.net for those for a start, just add the name on the end like this http://ie.php.net/strip_tags


  • Closed Accounts Posts: 7,145 ✭✭✭DonkeyStyle \o/


    I like regular expressions, if you don't absolutely need to store a lot of special characters... like for example form input where you know exactly what to expect.
    Instead of trying to prepare for everything that might be thrown at, just pick out the part of the input you're expecting and dump the rest.

    look up preg_match_all() there are plenty of examples for popular tasks.


Advertisement