Open Tech Support
Open Tech Support Archives
Back to HomeCommunityReviewsGuidesDownloadsTech LinksMarketplaceContact Us
 »  SITE NAVIGATION
»  OTS Home
»  OTS Forums
»  OTS Archives

»  About our site
»  Search our site
»  Support our site

»  What is this site?
»  Who are we?
 
 
 »  ADVERTISMENT
 
  Pages: 1

URL syntax validation

(Click here to view the original thread with full colors/images)


Posted by: Daniel

Hi there, I'm looking for a simple way of checking that the syntax of a URL entered into a field is correct, using both JavaScript and PHP.

I figured that I'd put the http:// in for them (to avoid people putting other protocals in there) meaning they just need to put in a valid url (i.e. theworldofdan.co.uk).

Can anyone point me in the direction of the best way of doing this please? I.e. the javascript code (for the inital error checking) and the PHP code (for the server side checking). I'm fairly sure it's just a case of using the correct regular expression for ereg(), but that side of things confuses me.

(PS, I'm not 100% on needing the http:// to be outside the text box, if you know someway that it can be used inside the box, or whatever.. then great)



 
Copyright 2000-2008 Open Tech Support.  All Rights Reserved.  Site Design and Development by Tolitz Rosel.