On p, 2007-01-26 at 14:10 +0000, Corden James (RW3) CM&MC Manchester wrote: > I have a form in which users submit a url. I am having problems as some > people submit the url in the format http://www.blah.blah.org > <http://www.blah.blah.org/> while others submit in the format > www.blah.blah.org <http://www.blah.blah.org/> I have designed the form > so that it seems fairly obvious (to me anyway) not to include the > http:// but people are still doing it (presumably because they are > copying and pasting from a browser). My form processing script is > designed to add http:// to the submitted url and place the modified url > in a database for future use. As you can imagine sometimes I end up with > urls such as http://http://www.blah.blah.org > <http://http:/www.blah.blah.org> in my database. Hence I need a more > rigorous form processing script that is capable of first checking if the > url includes http:// and then processes accordingly. Can anyone point me > in the right direction for such a script? > > > You should first check the url and only add "http://" at the beginning if its not there I do it like if (substr($url, 0, 4) != "http") {$url = "http://" . $url;} in my website, although it is probably not the most elegant solution ;) hope that helps Zoltán Németh > Thanks > > > > Dr James Corden > > Technology Evaluation Manager > > TrusTECH, Innovation Unit > > 1st Floor Postgraduate Centre > > Manchester Royal Infirmary > > Oxford Road > > Manchester > > M13 9WL > > > > Tel: 0161 276 5782 > > Fax: 0161 276 5766 > > E-mail: james.corden@xxxxxxxxxxx > > Web: http://www.trustech.org.uk > > This email and any files transmitted with it are confidential and solely > for the use of the intended recipient. It may contain material protected > by law as a legally privileged document and copyright work. Its content > should not be disclosed and it should not be given or copied to anyone > other than the person(s) named or referenced above. If you are not the > intended recipient or the person responsible for delivering to the > intended recipient, be advised that you have received this email in > error and that any use is strictly prohibited. > > If you have received this email in error please notify sender > immediately on +44 (0161) 276 5782 > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php