Copy initial letter to another field


Hope someone can help a real newbie!
I have set a form up, where a user inputs various things - one being a surname, which goes into MySql.
I also have a category field (which was to be a drop down list of the alphabet -too long!), but I am (sorry) mis-trusting users to put their own initial letter of their surname as the catergory! i.e: Surname: Hall, catergory: H.

Is there a way (inPHP) to automatically copy the intial letter (Capatalised) of the surname and put it into the catergory field? (on submission of the form?)

These are the fields in question:

Many thanx

:lol: :lol:


[php]// Ensures first letter is Uppercase of surname
$surname = ucfirst($surname);
// uses only the first letter for the Category.
$category = substr($surname, 0,1);