Page 1 of 1

Changing to a string to Title Case

Posted: Tue Jun 08, 2010 1:16 pm
by j2ee
I found that php has it's own built in function for this I just can't figure out where to put it. I have a form with a couple specific fields that I would like to process with this and so far I figured I would put it in the value field:

Code: Select all

<tr>
			<td colspan="2" height="13">&nbsp;</td>
		</tr>
		<tr>
			<td align="right"><span class="red">*</span> Last name:&nbsp;</td>
			<td><div style="float:left">
					<input name="lastName1" type="text" size="45" id="lastName1" maxlength="60" value="<?=$lastName1=ucfirst(strtolower($lastName1)),$_POST['lastName1']?>" />
					</div></td>
		</tr>
My only worry is that there is no:

Code: Select all

firstName1=$firstName1
anywhere in the form, and where would I put it?

Re: Changing to a string to Title Case

Posted: Tue Jun 08, 2010 1:28 pm
by j2ee
or would it work like this without the $:

Code: Select all

	
<tr>
	<td align="right"><span class="red">*</span> First name:&nbsp;</td>
	<td><input name="firstName1" type="text" size="45" id="firstName1" maxlength="60" value="<?=firstName1=ucfirst(strtolower(firstName1))?><?=$_POST['firstName1']?>" /></td>
	</tr>