jcanker Posted August 19, 2007 Share Posted August 19, 2007 I'm trying to create a web page that registers users in our internal php tools db table, our xmb forum members table, and our wiki authors table with one registration form. The wiki uses wikinames as the login, so I need to convert the created username into a wikiname. Registration is turned off to the public, so our board managment will be creating the users. Generally, the usernames will be firstnamelastname, but that will not always be the case eg hyphenated last names. The username will ALWAYS start with the first name, however. I'm trying to write a function to convert the username to a wiki name (2 words run together; each word is capitalized.) The user "Test Dude" would have a username of "testdude" but needs a wikiname of TestDude. Here's what I've been experimenting with: (fname is the first name from the form and $longname is the username entered on the form...they're created from the $_POST data earlier in the code... $length = strlen($fname); $length = $length++; $wikiname = ucfirst($longname); strtoupper($wikiname[$length]); return $wikiname; This is converting the first letter fine with the ucfirst, but the first letter of the last name is not working properly. It is returning Testdude instead of TestDude. I'm sure it's a simple fix. Can anyone tell my why it's not working? Quote Link to comment https://forums.phpfreaks.com/topic/65659-convert-name-to-wikiname/ Share on other sites More sharing options...
jcanker Posted August 19, 2007 Author Share Posted August 19, 2007 I got it figured out..... $length = strlen($fname); $length = $length++; $wikiname = ucfirst($longname); $wikiname[$length] =strtoupper($wikiname[$length]); return $wikiname; Quote Link to comment https://forums.phpfreaks.com/topic/65659-convert-name-to-wikiname/#findComment-327934 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.