turpentyne Posted February 23, 2012 Share Posted February 23, 2012 I can't get this bit of verification to recognize the apostrophe. I've tried putting the apostrophe in the front of the A, escaped it with a backslash. Escaped the backslash itself, like you see below. Nothing seems to get that apostrophe recognized. $first_name = $_POST['first_name']; // required $string_exp = "/^[A-Za-z\\-\\., \\']+$/"; if(!preg_match($string_exp,$first_name)) { $error_message .= 'The First Name you entered does not appear to be valid.<br />'; I've tried quite a few combinations. Here are a few more that didn't work: $string_exp = "/^[A-Za-z\\-\\., \']+$/"; $string_exp = "/^[A-Za-z\-\., \']+$/"; $string_exp = "/^[A-Za-z' .-]+$/"; $string_exp = "/^[A-Za-z .'-]+$/"; Link to comment https://forums.phpfreaks.com/topic/257594-apostrophe-in-verification-string/ Share on other sites More sharing options...
Pikachu2000 Posted February 23, 2012 Share Posted February 23, 2012 It seems to work fine for me. Link to comment https://forums.phpfreaks.com/topic/257594-apostrophe-in-verification-string/#findComment-1320306 Share on other sites More sharing options...
requinix Posted February 23, 2012 Share Posted February 23, 2012 Turn off magic_quotes. Link to comment https://forums.phpfreaks.com/topic/257594-apostrophe-in-verification-string/#findComment-1320315 Share on other sites More sharing options...
turpentyne Posted February 24, 2012 Author Share Posted February 24, 2012 aha! Yep, that did it. Had to do it through .htaccess with: php_flag magic_quotes_gpc Off as simple as that! Link to comment https://forums.phpfreaks.com/topic/257594-apostrophe-in-verification-string/#findComment-1320792 Share on other sites More sharing options...
AyKay47 Posted February 24, 2012 Share Posted February 24, 2012 Quote aha! Yep, that did it. Had to do it through .htaccess with: php_flag magic_quotes_gpc Off as simple as that! you don't have access to the servers php.ini file? Link to comment https://forums.phpfreaks.com/topic/257594-apostrophe-in-verification-string/#findComment-1320793 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.