Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    May 2012
    Thanked 0 Times in 0 Posts

    domain url validation problem

    hi friend i need you help i want create a form where when i add a domain its store to database

    but problem is i want only without http:// or www domains save in database other wise show error please

    enter domain without http:// or www

    please tell me what php code for this validation thanks in advanced

  • #2
    Regular Coder LearningCoder's Avatar
    Join Date
    Jan 2011
    The Pleiades
    Thanked 29 Times in 29 Posts
    Good evening,

    There are a number of things you can check for.

    • Certain types of characters within the sting such as forward slashes or colons.
    • The amount of periods (.) within the string.
    • Where in the string are they - for example they cannot be at the very end or start of the string.
    • To check the extension (.co.uk, .net, .org.uk) you could save all possible extensions into an array and check whether they are contained at the very end of the string

    Maybe a regular expression would be best to tackle this.

    Have you wrote anything so far? I don't mind modifying an existing script but if you want me to write it, you will need to become a client of mine.

    Hope the list has given you a good basis on what to look for!

    Kind regards,


  • #3
    New Coder
    Join Date
    Sep 2013
    Thanked 1 Time in 1 Post
    Well, i have used it in my application using regex.
    Below is the validation pattern in regex which has worked fine for me:


    Hope this helps.


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts