Contributions

Features (Category Index)
Search: 

Capitalize First Letter for Create Account Fields

This may be the simplest contribution ever. Many of our customers were to lazy to capitalize the first letter of the following fields :

First Name
Last Name
City
Business Name
Street Address

This drove me crazy, so, I fixed this for them on the fly using the ucwords() function.

-------------------

Example from create_account.php

To capitalize the first letter of the "first name" field:

FIND :

$firstname = tep_db_prepare_input($HTTP_POST_VARS['firstname']);

CHANGE TO :

$firstname = tep_db_prepare_input($HTTP_POST_VARS['firstname']);
$firstname = ucwords($firstname);

------------

Done! Simply do that for any field you wish to capitalize for your customers.

Expand All / Collapse All

vans macs mcs etc. trevwilson 6 Sep 2007

So simple yet so complicated!

Converting last names is not such an easy task, what about all those MacDonalds that become Macdonalds or the Hyphen-Hyphens that become the Hyphen-hyphens or the van der Capitals that become the Van Der Capitals...

Have a look at this on php.net:
http://www.php.net/manual/en/function.ucwords.php
then scroll down a bit. The contributions from the Italians are pretty comprehensive but still in the end none of them work 100%...

Mind you all is well if you are a MacDonald but there again what about the Macallisters who then become the MacAllisters!

Complete Update of User Input and Edit Files bob61 5 Sep 2007
On edit greg_cmwd 5 Sep 2007
Last name also Ausgirl 2 Sep 2007
Change to Lower Case Then Capitalize First Letter dskl 2 Sep 2007
Capitalize First Letter for Create Account Fields phi148 22 Jul 2007

Note: Contributions are used at own risk.