Hello.
This is a multi-part question. I have researched each aspect of it before posting here, but I am posting this in case anyone may point out something I might have over-looked.
I am building a profanity filter to be used upon submission of a form - I assume, obviously, that this must be run before the actual data is submitted to the database. I am thinking this list of words (A seperate, include file of an array being called) should be located on the same page above the DB connection code. This I need to make sure about.
Also, upon submission, should there be profanity in the form fields I must notify the User; I have thought that if the profanity filter returns true for an offending word (From the array for any particular field) I would refresh the form page, the offending fields now empty, and display a jQuery message saying something to the effect of:"Please use appropriate content!". This part is confusing to me.
If the profanity filter catches a bad word in the form before submitting data to the DB, is it best to refresh/redirect the form/page like this? If so, where does this particular code go? Beneath the profanity filter code (Above the DB connection code) by using an AND OR to cycle through the array, for example?
I hope I am explaining this correctly and clearly.
Note: I have no code written for this yet to provide as an example for my question.
Thank you in advance for any advice or pointers in the right direction!
Matthew