Jump to content

Force Lower case


Greatone
Go to solution Solved by cyberRobot,

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
Share on other sites

  • Solution

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.