Ok, guys i need some help on this one! I am setting up the user creation section of a site. The form has First Name, Last Name, and privileges. On submit it will generate a random password and and I want it to take the first initial of the first name and the first seven letter from the last name to create the user name. I am doing a auto password because the creation of accounts is done by a Manager not the user. This will force the user to change the password and not have the manager know it. The question is how do i go about getting the first and last name into a user name. The form runs as a post then I set the post vars as a short variable of $fname, $lname. After this is figured out I want to get it to run a check on the MYSQL db and add a number to the end of the user name if it is in use already. Thank you for any help in advance.
TGLMan
firstly there is a flaw to this
same surnames do not have 7letters in it.
Anyway try this out
$firstname = "paul"; $lastname = "williams"; $username = substr($firstname,0,1)."".substr($lastname,0,7); echo $username;
Should i go with something smaller, I guess I overlooked this mine has more then 7 and was just not thinking
the above code will do it for you
http://www.php.net/substr