Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Customer name and address in uppercase


posword

Recommended Posts

Posted

I want to force the customer's name and address to be in uppercase as or before it is being inserted into the database. Some customers use all lowercase and some mixed case. A search reveals the command upper() function will do it.

 

Any ideas where I need to put this in the code and in which file(s)?

 

Thanks,

Peter

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

Online since 1995! -- the home

of inspiration and motivation for generic New Testament Christians.

New books by Peter Wade now available from Amazon and others --

Our new book, Bunches of Blessings: Poems by Vivien Wade.

Posted

You could try using strtoupper().

 

If you look in the create_account.php you will find this code:

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

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

 

This is the first name and the last name. You will find more like street_address, city, state and country. This is what you would change the above two lines too if you want to make them upper case no matter what:

 

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

$lastname = tep_db_prepare_input(strtoupper($HTTP_POST_VARS['lastname']));

Other great Open Source (Free) programs: (Free as in free speech not free beer)

The Gimp - An image program. | Firefox - All you have to do is add the Web Developer add-on to make this web browser complete. | FileZilla - An ftp program. | Inkscape - A good program to create images with. | Thunderbird - An email program. | Openoffice.org - An office suite that is compatible with MS Office. | Abiword - Another office suite. | Audacity - A sound recording tool. | ddp's Picks | Wordpress - An easy to use blogging software. | Joomla - An easy to use CMS that has ecommerce plug-ins. | Drupal - Another CMS

How do I find these programs? Google Search!

Posted
I want to force the customer's name and address to be in uppercase as or before it is being inserted into the database. Some customers use all lowercase and some mixed case. A search reveals the command upper() function will do it.

 

Any ideas where I need to put this in the code and in which file(s)?

 

Thanks,

Peter

I used this code:

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

And it works on everything except names like McCallahan. The second C will be lower case. This code converts everything to lower case, then makes the first letter capitalized.

 

Tim

  • 2 weeks later...
Posted
You could try using strtoupper().

 

Thanks, natewlew, I've made the changes.

 

Peter

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

Online since 1995! -- the home

of inspiration and motivation for generic New Testament Christians.

New books by Peter Wade now available from Amazon and others --

Our new book, Bunches of Blessings: Poems by Vivien Wade.

  • 11 months later...
Posted
I used this code:

    $firstname = tep_db_prepare_input($_POST['firstname']);
   if ((strcmp($firstname, strtoupper($firstname)) == 0)) $firstname = strtolower($firstname);
   if ((strcmp($firstname, strtolower($firstname)) == 0)) $firstname = ucwords($firstname);
   $lastname = tep_db_prepare_input($_POST['lastname']);
   if ((strcmp($lastname, strtoupper($lastname)) == 0)) $lastname = strtolower($lastname);
   if ((strcmp($lastname, strtolower($lastname)) == 0)) $lastname = ucwords($lastname);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...