TomTees Posted November 27, 2010 Share Posted November 27, 2010 Another bizzare thing that stopped working all of a sudden... I have a registration form and this code no longer works... // Check for First Name. // Allow letters, space, period, apostrophe, and hyphen. if (preg_match('/^[A-Z\'.-]{2-20}$/i', $_POST['first_name'])){ $fn = mysqli_real_escape_string($dbc, $_POST['first_name']); } else { // Add error-message to array. $reg_errors['first_name'] = 'Please enter your first name!'; } All day when I typed in a two letter answer - to speed up typing and testing - things worked fine, but now I get a built-in error message off to the side of the input box. I typed 'ee' and that always worked before but no luck now. The Reg Ex hasn't changed. Could it be that there is a database connectivity issue that is screwing up my RegEx?? If I comment out all of the RegEx stuff then it works and my INSERT works - thanks to AlexWD TomTees Quote Link to comment Share on other sites More sharing options...
this.user Posted November 27, 2010 Share Posted November 27, 2010 Just use: '/[a-zA-Z\'.-]{2,20}$/' I just noticed you are using a dash ('-') is should be a comma, as far as I know Quote Link to comment Share on other sites More sharing options...
TomTees Posted November 27, 2010 Author Share Posted November 27, 2010 Just use: '/[a-zA-Z\'.-]{2,20}$/' I just noticed you are using a dash ('-') is should be a comma, as far as I know UGH!!! What a freshman mistake!! (Looks like my elderly eyes failed me at nearly 2:00am last night!!) Thanks for the catch!!! TomTees Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.