Quick php question for the experts out there. We have a form which users are filling out. They should be just submitting a username into the form, so for example "myusername" would be a value. BUT some are somehow submitting "www.myusername". Many claim that their browser pre-fills this. We have been displaying an error when this happens, but many continue to ignore it. How can we check on the back end if the username submitted has "www." in it, and strip it out if it does (before doing anything with the username like submitting it to the database).
wow.. that's pretty easy .. thanks! So what happens if the username doesn't have www.? It just doesn't remove anything?
See http://php.net/str_replace : So yes, it doesn't remove anything if it's not in there. You may also be interested in str_ireplace to do a case insensitive replace.