PHP - CASE problem - Asked By Olusegun A. on 06-Oct-09 05:57 PM

Hello Success-Oriented People,

I have a form. when my visitors are filling the form, i want some fields to start in tittlecase, i want in some fields to be uppercase without the visitor turning on the  CAPLOCK key on the keyboard and some other fields to be lowercase. how do i do it?


Vasanthakumar D replied to Olusegun A. on 06-Oct-09 11:41 PM


you can use the text-transform style to convert the text...

<input type="text" style="text-transform:uppercase;" />  -- For uppercase

<input type="text" style="text-transform:lowercase;" /> -- for lowecase

Hi, do this - Vishal Chourasiya replied to Olusegun A. on 07-Oct-09 12:20 AM

You can use Style property of textbox control like this:-

// for Upper case

<asp:textbox id="txt1" runat="server" style="text-transform:uppercase;" ></asp:textbox>

// for Lower case

<asp:textbox id="txt1" runat="server" style="text-transform:lowercase;" ></asp:textbox>

//you can also do like this

public void toUpper(TextBox txt){

txt.Attributes.Add("onKeyUp", "this.value=this.value.toUpperCase();");}


Make a style-sheet like

<style type="text/css">
        text-transform: uppercase;       

<asp:TextBox ID="TextBox1" runat="server" CssClass="uppercase"></asp:TextBox>

//do same stylesheet for lowercase letter

reply - Deepak Sonawane replied to Olusegun A. on 07-Oct-09 01:01 AM

Converting string to upper case in php:
$originalString = "String Capitalization 1234"; 

$upperCase = strtoupper($originalString);
echo "Old string - $originalString <br />";
echo "New String - $upperCase";

Converting string to lower case in php:

$originalString = "String Capitalization 1234";

$lowerCase = strtolower($originalString);
echo "Old string - $originalString <br />";
echo "New String - $lowerCase";

You can use javascript in php like this:

echo '<script type="text/javascript">
if ( 1 ) {\'modules.php?name=News\', \'_WELCOME\',
\'HEIGHT=450, resizable=yes, WIDTH=600\');

code for changing enter Upper text into lower text:
<html><head><title>(Type a title for your page here)</title>

<script type="text/javascript">

function change_case()






<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000" onLoad="form1.type.focus();">

<form name=form1 method=post action=''''>

<input type=text name=type value=''Enter USER ID'' onBlur="change_case();">

<input type=submit value=Submit> </form>