Transform Customer Name all Upper case letter and make first character to upper case - PHP | IPrpgramX

Slip no. 20 Write a PHP script to accept Customer Name from user and do the following             
a) Transform Customer Name all Upper case letter               
b) Make first character to Upper case.--> 


 HTML File:

<html>
<body>
<form method="POST" action="slip20prog1.php">
Enter Customer Name:<input type="text" name="name"><br><br>
<input type="radio" name="option" value="1">Tranform all to uppercase<br><br>
<input type="radio" name="option" value="2">Make First Character to uppercase<br><br>
<input type="submit">
</form>
</body>
</html>

 PHP File:

<?php  $name=$_POST['name'];
  $choice=$_POST['option']; 
  switch($choice)
    { 
        case 1: echo "<h2>After Tranforming $name to uppercase</h2><br>";
                echo "<b>".strtoupper($name)."</b>";
                break;
        case 2: echo "<h2>After Making $name first character to upper</h2><br>";
                echo "<b>".ucfirst($name)."</b>";
                break;
        default : echo "Please choose one operation";
    }
?> 

Post a Comment

0 Comments