Capitalization of web form input

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • icrash2

    Capitalization of web form input

    Hi,

    I'm using PHP to submit form input to MySQL and need a way to
    capitalize the first character for certain fields. Does anyone know of
    some way to achieve this?

    Much appreciated
  • Randell D.

    #2
    Re: Capitalization of web form input


    "icrash2" <nospam5@mxmoto .com> wrote in message
    news:82d46cd0.0 312281936.595b8 ac9@posting.goo gle.com...
    Hi,

    I'm using PHP to submit form input to MySQL and need a way to
    capitalize the first character for certain fields. Does anyone know of
    some way to achieve this?

    Much appreciated

    ucwords() should do it...

    Uppercase the first character of each word in a string



    Comment

    • Manuel Lemos

      #3
      Re: Capitalization of web form input

      Hello,

      On 12/29/2003 01:36 AM, icrash2 wrote:[color=blue]
      > I'm using PHP to submit form input to MySQL and need a way to
      > capitalize the first character for certain fields. Does anyone know of
      > some way to achieve this?[/color]

      There is a function in PHP for doing that, but you may also want to take
      a look at this class that among many other features of interess in form
      generation and validation, it lets you specify capitalization rules: all
      lowercase, all uppercase and just word initials (as you want).

      The point of using this class for that purpose is that, besides doing it
      on the server side, it will also capitalize the field values on the
      client side (Javascript) right when the user changes them, so the user
      can see that the form is capitalizing the words that are entered before
      processing them.




      --

      Regards,
      Manuel Lemos

      Free ready to use OOP components written in PHP
      Free PHP Classes and Objects 2025 Versions with PHP Example Scripts, PHP Tutorials, Download PHP Scripts, PHP articles, Remote PHP Jobs, Hire PHP Developers, PHP Book Reviews, PHP Language OOP Materials


      Comment

      • CountScubula

        #4
        Re: Capitalization of web form input

        nospam5@mxmoto. com (icrash2) wrote in message news:<82d46cd0. 0312281936.595b 8ac9@posting.go ogle.com>...[color=blue]
        > Hi,
        >
        > I'm using PHP to submit form input to MySQL and need a way to
        > capitalize the first character for certain fields. Does anyone know of
        > some way to achieve this?
        >
        > Much appreciated[/color]


        ucfirst() uppercases first letter in a string
        ucwords() uppercases firtw letter of every word in string


        Mike Bradley
        http://gzen.myhq.info -- free online php tools

        Comment

        • Geoff Berrow

          #5
          Re: Capitalization of web form input

          I noticed that Message-ID:
          <ed2d44d4.03122 82245.144c638f@ posting.google. com> from CountScubula
          contained the following:
          [color=blue][color=green]
          >> I'm using PHP to submit form input to MySQL and need a way to
          >> capitalize the first character for certain fields. Does anyone know of
          >> some way to achieve this?
          >>
          >> Much appreciated[/color]
          >
          >
          >ucfirst() uppercases first letter in a string
          >ucwords() uppercases firtw letter of every word in string[/color]

          But as someone pointed out in a recent thread, for names this may not be
          what you want e.g. van Damme, de Werke..
          --
          Geoff Berrow (put thecat out to email)
          It's only Usenet, no one dies.
          My opinions, not the committee's, mine.
          Simple RFDs http://www.ckdog.co.uk/rfdmaker/

          Comment

          • Zaphod Beeblebrox

            #6
            Re: Capitalization of web form input

            Geoff Berrow <blthecat@ckdog .co.uk> wrote in message
            news:ebvvuvsbf5 fse3mu8644o61c8 2lev5ghhh@4ax.c om...[color=blue]
            > I noticed that Message-ID:
            > <ed2d44d4.03122 82245.144c638f@ posting.google. com> from CountScubula
            > contained the following:
            >[color=green][color=darkred]
            > >> I'm using PHP to submit form input to MySQL and need a way to
            > >> capitalize the first character for certain fields. Does anyone know of
            > >> some way to achieve this?
            > >>
            > >> Much appreciated[/color]
            > >
            > >
            > >ucfirst() uppercases first letter in a string
            > >ucwords() uppercases firtw letter of every word in string[/color]
            >
            > But as someone pointed out in a recent thread, for names this may not be
            > what you want e.g. van Damme, de Werke..
            > --
            > Geoff Berrow (put thecat out to email)
            > It's only Usenet, no one dies.
            > My opinions, not the committee's, mine.
            > Simple RFDs http://www.ckdog.co.uk/rfdmaker/[/color]

            Use explode() to turn the string into an array, then capitalize each word
            that doesn't match "van" "de" etc using a loop.


            Comment

            Working...