Page 1 of 1

[SOLVED] appending characters

Posted: Thu Oct 27, 2005 1:40 pm
by $var
hello,

how would i go about adding a string to an entry, only if it doesn't exist already.
on entering a URL in a member field, i have found most people prefer to omit http://
which just comes up as http://www.mydomain.com/www.theirdomain.com and returning a 404.

how i do i go about automatically adding the http:// if they don't... and only if they don't?

Posted: Thu Oct 27, 2005 1:43 pm
by feyd
prepending http:// can be done via simply looking at the output of strpos() to make sure http:// is the first part of the string. If it fails or is later in the string

Code: Select all

$url = 'http://' . $url;

Posted: Thu Oct 27, 2005 2:27 pm
by $var
thank ya!