FORCING UPPER CASE, LOWER CASE, AND INITIAL CAPS TO BE SENT TO THE DATABASE - Jun 1st, 2011


Sometimes it’s important to send only certain case formats to your database. State abbreviations, first and last
names, and middle initials are a few examples.

It’s pretty easy, but you’ll have to implement any changes on both the signup and the profile revision form pages.

In the “// add user” section of the signup form, fairly near the top of the page, you’ll find:



mysql_query("INSERT INTO `{$TABLE_PREFIX}accounts` SET



And in the “// update user” section of the profile page, you’ll find:



$query = "UPDATE `{$TABLE_PREFIX}accounts` SET



Just before each of those lines, insert any of the following, creating a new line of code for each field that you want
to control:

To force each word to begin with a capital letter:



@$_REQUEST['your_field']=ucwords(@$_REQUEST['your_field']);



To force only the first character in the field to begin with a capital letter:



@$_REQUEST['your_field']=ucfirst(@$_REQUEST['your_field']);



To force the entire field to be converted to capital letters:



@$_REQUEST['your_field']=strtoupper(@$_REQUEST['your_field']);





The materials on this web site have been created for use with CMS Builder content management software. CMS Builder software is published and licensed for use by InteractiveTools.com. Please contact Interactive Tools for information on the downloading of the software or the purchasing of licenses.


Terms of Service