Results 1 to 7 of 7

Thread: Help with fill-in form?

  1. #1
    Join Date
    Dec 2008
    Location
    I live in Singapore, but I'm French.
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help with fill-in form?

    Hey!

    Well, I'm really new to coding and I'm stuck. I've recently created a fill-in form for my website and there are a few things I would like to fix but don't know how.

    So far, all i have is a notice that says "Please submit a valid email address" (all it does is check if there is an "@" symbol and things like that) but i would like it to check if it is a registered/working email address as well.
    Is there also a way of making sure that all of the fields in the form are filled in, before submission?

    Also, is there a way of knowing if the "person/thing" on the other side that is entering the information into my form is really a person, and not some coded web robot or something?

    Since my code is too long to fit into this box, here's the link to my webpage:
    http://www.leopoldine-jpm.com/ttorder.htm

    can someone please help me?

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Jeremy | jfein.net

  3. #3
    Join Date
    Dec 2008
    Location
    I live in Singapore, but I'm French.
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thank you! ^_^

    but now im stuck because i don't know where to put what. >.<
    My form is an HTML document with PHP working in the background. it's not PHP inside an HTML document.

    http://recaptcha.net/plugins/php/

  4. #4
    Join Date
    Dec 2008
    Location
    I live in Singapore, but I'm French.
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    okay. so after fiddling around with the codes, i finally managed to get the reCAPTCHA thingy working.

    but how about:
    So far, all i have is a notice that says "Please submit a valid email address" (all it does is check if there is an "@" symbol and things like that) but i would like it to check if it is a registered/working email address as well.
    Is there also a way of making sure that all of the fields in the form are filled in, before submission?

  5. #5
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    Eddy Proca
    I love Dropbox. Get it through my girlfriend's referral link (I reached my limit) and both you and her get 500 MB extra! Thanks and you're welcome!

  6. #6
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    This doesn't check if the email exists but it should validate it:
    PHP Code:
    function is_valid_email($email){
       if(
    preg_match("/[a-zA-Z0-9_\-.+]+@[a-zA-Z0-9-]+.[a-zA-Z]+/"$email) > 0){
          return 
    true;
       }else{
          return 
    false;
       }

    [edit]
    Here's a code to see if the myemail@gmail.com is a valid(the site):
    PHP Code:
    function is_real_site($email){
       
    $email preg_split("/[@]+/"$email);
       
    $ip $email[1];
       
    exec("ping -n 4 $ip 2>&1"$output$retval);
       if (
    $retval != 0) { 
          
    $check false;
       } else { 
          
    $check true;
       }
       return 
    $check;

    If so the function will return "1."
    Inspired by: http://www.dynamicdrive.com/forums/s...85&postcount=1

    Edit: BUG IN ABOVE CODE! Someone could type: shutdown in the email address, and the server would shut down.
    Last edited by Nile; 12-21-2008 at 05:42 PM.
    Jeremy | jfein.net

  7. #7
    Join Date
    Dec 2008
    Location
    I live in Singapore, but I'm French.
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    well so far, i've got this checking the email address and it's doin a pretty good job at it:
    PHP Code:
    <script language="JavaScript" type="text/javascript">
     function 
    validateForm(order)
     {
            
    //oForm refers to the form which you want to validate
            
    order.onsubmit = function() // attach the function to onsubmit event
            
    {
                    var 
    regex = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
                    if(
    order.elements['email'].value.length<1)
                    {
                            
    alert("Please enter your email address.");
                            return 
    false;
                    }
                    else if(!
    regex.test(order.elements['email'].value))
                    {
                            
    alert("Please enter a valid email address.");
                            return 
    false;
                    }
                    return 
    true;
            }
     }
     
    </script> 
    but it doesnt check the VALIDITY of anything, it just checks for typos. -_-

    Nile: i tried entering your code but it doesnt work.

Tags for this Thread

Bookmarks

Posting Permissions

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