form submit without domain extention if domain extention include then form not submit

Discussion in 'PHP' started by dineshsingh1984, Oct 4, 2012.

  1. #1
    I want to validation in form where user enter url without extention for example : www.example.com is not valide and www.example is valid
     
    dineshsingh1984, Oct 4, 2012 IP
  2. Vick.Kumar

    Vick.Kumar Active Member

    Messages:
    138
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    90
    #2
    It's pretty simple you would have something like this;

    
    <?php
    $url = $_POST['url'];
    if(contains($url))
    {
    error
    }
    else
    {
    carry on
    }
    ?>
    
    HTML:
    Of coarse that isn't exactly the exact code, But I'd rather give you an idea than do the whole code for you, otherwise you won't learn. All you would possibly need to do is get the posted data, and see if it 'contains' maybe an array of TLD's, and if it does, reject. etc.
     
    Vick.Kumar, Oct 5, 2012 IP
  3. real_person

    real_person Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I wrote a code for you,

    digitalpoint.com is valid

    digitalpoint NOT VALID

     
    real_person, Oct 5, 2012 IP