Jump to content

Force Lower case


Greatone

Recommended Posts

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 do
don'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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.