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 Link to comment https://forums.phpfreaks.com/topic/219966-form-validation-failing/ 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 Link to comment https://forums.phpfreaks.com/topic/219966-form-validation-failing/#findComment-1140230 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 Link to comment https://forums.phpfreaks.com/topic/219966-form-validation-failing/#findComment-1140324 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.