JD_Toims - 6:14 pm on Jul 23, 2013 (gmt 0)
I would either leave it as NULL (a little more coding involved) or use JD_Toims' method with an empty string (i.e., '') instead of 'NA' in the field.
Anything "short" is cool in my opinion.
The reason I opted for NA is rather than leaving it NULL is if it's "something" we know "got the info and processed the script, but the user gave No Answer or incorrect info to [whatever] values." ... If it's NULL and NULL is the default "don't know" then it makes "did the user opt to not give us the info, enter something incorrectly or did we have a 'glitch' somewhere?" a bit tougher to identify.
If there's a "known value" that should be the "default" in all cols after the script runs and we find a NULL somewhere, we know there was a glitch in our system, but if NULL is the default and we leave "Not Answered" as NULL, then it can make trouble-shooting a bit more difficult in some cases.
Anyway, that's why I enter some type of "short not NULL something", but it's probably not a big deal either way in most situations.
I'm very new at both php and mysql and don't understand the preg_match code.
The regex doesn't "check for anything" currently since I don't know what info should be present for each field, but if there was an actual pattern rather than PATTERN_HERE and the posted information matched that pattern, then the posted information would be entered in the col rather than the NA I set the variables to initially.
There's some info on pattern here: [webmasterworld.com...]