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> Link to comment https://forums.phpfreaks.com/topic/289100-force-lower-case/ Share on other sites More sharing options...
cyberRobot Posted June 10, 2014 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"> Link to comment https://forums.phpfreaks.com/topic/289100-force-lower-case/#findComment-1482386 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.