logo
Blog single photo

How to generate User name by using "1st two letters of forename" , "1st two letters of Surname" and "birthday day from dd/mm/yyyy"?


                        

<?php
if(isset($_POST['name'])){
    $name=$_POST['name'];
    $sname=$_POST['sname'];
    // Get To ltr
    $str1=substr($name, 0, 2);
    $str2=substr($sname, 0, 2);
   
    $dob=$_POST['dob'];
    $str3=explode('/', $dob);
    $str3=$str3[0];

    $username=$str1.''.$str2.''.$str3;
    echo $username;

    // Use Lower
    
    //echo strtolower($username)

}

?>
 
<form method="post" action="">
<input type="text" name="name" value="Naitik">
<input type="text" name="sname" value="Chovatiya">

<input type="text" name="dob" value="02/08/1988">
<input type="submit" value="Save">
</form>

Top