Greatone Posted June 10, 2014 Share Posted June 10, 2014 i want to make a simple forced lower case form but i got stuck on it to begin with i want to everything user's write and submit convert to lowercase am i using the right code? i'm not sure about using preg_match in this situation but i dont know what else to dodon't be harsh with me i'm noob <?php if(isset($_GET['user'])&&!empty($_GET['user'])) { $user = $_GET['user']; if (preg_match('$englishUpperAlphabet'//English alphabet Upper case array//',$user)){ $user = mb_strtolower($user); echo $user; } else{ echo 'none'; }} ?> <form action="t.php" action="GET"> name: <input type="text" name="user" > <br> <input type="submit" value="submit" > </form> Quote Link to comment https://forums.phpfreaks.com/topic/289100-force-lower-case/ Share on other sites More sharing options...
Solution cyberRobot Posted June 10, 2014 Solution Share Posted June 10, 2014 Why not just convert everything to lowercase? <?php if(isset($_GET['user'])&&!empty($_GET['user'])) { $user = mb_strtolower($_GET['user']); echo $user; } ?> Note that your <form> tag has two action attributes. This: <form action="t.php" action="GET"> Should be changed to this: <form action="t.php" method="GET"> Quote Link to comment https://forums.phpfreaks.com/topic/289100-force-lower-case/#findComment-1482386 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.