PDA

View Full Version : PHP newby has quick and easy question!


Velocd
07-13-2002, 06:06 AM
I need to know how to verify the amount of characters in an input field.

For example, if an input field value were to be $bbuserinfo[homepage], thus putting the users homepage url in that field, by what code can I find the amount of characters used in the homepage url?

I need this for an if-then comparison I am using where a user can insert a URL into a input field or a hexadecimal color. Obviously no URL is going to be smaller than 8 characters, so by easily comparing if the value in the field is greater than 7, I can decipher whether or not that user is inputting a URL or a hexidecimal color (this is needed for a hack of mine).

So any idea how I can find out the amount of characters this input field contains, after submition that is?

I thought about..


if($inputfield) > 7)


But that wouldn't make sense, because it's comparing it to a numerical value, not the amount of characters used.


Any help would be nice,
Thnx ;)

Admin
07-13-2002, 07:01 AM
You are looking for strlen(). :)