how to automatic text in a textbox all uppercase?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ehpratah
    New Member
    • Mar 2012
    • 35

    how to automatic text in a textbox all uppercase?

    hi i'm just wondering on how can i make all the type text in my textbox all uppercase using php? tnx Alot..
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    You can't do it in PHP since that's server side. You'll have to use javascript. Use the onkeyup event to change the value to upper case.

    Comment

    • ehpratah
      New Member
      • Mar 2012
      • 35

      #3
      hi rabbit can you give me an example code bout it...thanks

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        Sorry, I don't give out code unless the poster has shown an attempt at the solution.

        Comment

        • johny10151981
          Top Contributor
          • Jan 2010
          • 1059

          #5
          Well, I will give you a tips but you will have to figure out rest:
          if char is lower case then
          char=char-('a'-'A');

          you can make it simpler

          Comment

          • ehpratah
            New Member
            • Mar 2012
            • 35

            #6
            well actually already made a code bout it here it is
            Code:
            <?php
            $origin =$_GET['txtpickup'];
            $word = "$origin";
            $word = strtoupper($word);
            echo "$word";
            ?>
            the problem is i can make it uppercase during the form is submitted..what i really want is when the word is type in my textbox in the first form it will change to uppercase..and i cant find a way to do it without using a jquery or javascript..

            Comment

            • Rabbit
              Recognized Expert MVP
              • Jan 2007
              • 12517

              #7
              Like I already said, you must use javascript. By the way, jquery is just a javascript library, it's still javascript. Technically you can also use VBScript but that will only work on IE. And you can use ActionScript if you use Flash. I only mention them for completeness' sake. Your best option is javascript.

              Comment

              Working...