rjliquigan Posted November 21, 2009 Share Posted November 21, 2009 Hello all, new to the php scene. I'm having problems writing capital letters into the database: For example when i input MerryChristmas it will write erryhristmas or Testing123 it would be esting123. Any help would be greatly appreciated thank you heres what it looks like write now: $groupname=$_POST['groupname']; $newgroupname = preg_replace('/[^a-z0-9]/', '', $groupname); $check2 = mysql_query("SELECT groupname FROM groups WHERE groupname = '$newgroupname'") or die(mysql_error()); $check3 = mysql_num_rows($check2); Quote Link to comment https://forums.phpfreaks.com/topic/182447-new-to-php-preg-replace-help/ Share on other sites More sharing options...
Alex Posted November 22, 2009 Share Posted November 22, 2009 If you want to allow both lower and uppercase you can use the i modifier to enable case insensitivity. $newgroupname = preg_replace('/[^a-z0-9]/i', '', $groupname); Quote Link to comment https://forums.phpfreaks.com/topic/182447-new-to-php-preg-replace-help/#findComment-962865 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.