PDA

View Full Version : check if "www" change to "http://www"


homerUK
12-03-2002, 10:59 AM
hi,

I have been searching for ages for some code which will change a users entry in the DB of "www . something .com" to "http:// www. something. com"

(obviously without the spaces.. they are to stop this code from highlighting the URL!!)

There's a field in my DB for members websites, but most of them only enter "www." instead of the full "http://" and then the link does not work!

Many Thanks

glenngv
12-03-2002, 11:31 AM
Not all sites start at www.
So you should check if http:// is in the URL or not.
If not, insert it.

strURL = rsObj("URLfield")
if IsNull(strURL) then strURL = "" else strURL = trim(strURL)
if instr(1,strURL,"http://",1)<>1 then strURL = "http://" & strURL

homerUK
12-03-2002, 01:53 PM
thanks! That has worked perfectly!!

Cheers!!! :thumbsup: