First, strip_tags() is NOT defense against SQL injection. Second, as Francois B pointed out, the tags will only be stripped when the HTML form is loaded. It doesn't matter what the user types into the form itself in their web browser; you should be sanitizing strings after the form has been submitted but before the mysql queries are executed.
I repeat: strip_tags()
is NOT an anti-SQL injection measure. If you want nearly fool-proof protection from SQL injections, you need to look into prepared statements. In most cases, sanitizing your input with a character white list, using mysql_real_escape_string()
, and making sure your variables are enclosed in single-quotes is enough to protect against SQL injection.
It's far too easy for a new developer to shoot his or her self in the foot while using PHP and mysql; please do some research with Google and make sure to read http://bobby-tables.com/. Please ask for help and have someone experienced review your code before you publish a potentially vulnerable script.