The code below is part of a form. I would like the "username" input below to be converted to all lower-case letters regardless of what the user enters. How could I do this?
<div class="usernameformfield"><input tabindex="1" accesskey="u" name="username" type="text" maxlength="35" id="username" /></div>
EDIT: I know about strtolower. What I don't know is where to put it to make it work with the form.
in the form processing (asuming you are using GET method) do:
$username = strtolower($_GET['username'])
For a more instant conversion, the following code converts anything in an input box into lowercase, once the user selects anything else (the next box of a table for example)...
<input type="text" name="username" onChange="javascript:this.value=this.value.toLowerCase();">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With