Jump to content

Terfanda

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Posts posted by Terfanda

  1. [!--quoteo(post=385983:date=Jun 20 2006, 03:30 PM:name=SemiApocalyptic)--][div class=\'quotetop\']QUOTE(SemiApocalyptic @ Jun 20 2006, 03:30 PM) [snapback]385983[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    As it stands, that piece of code won't print anything to the screen. I ran your code on my machine and it runs perfectly fine, giving me the expected output. What is it (not) doing for you?

    I rewrote it for you though, you were going about it the long way a bit
    [code]
    function check_Name($Name,$FamName) {
        $Name_Pattern = "^[a-zA-Z]+$";
        if((eregi($Name_Pattern,$Name)) && (eregi($Name_Pattern,$FamName))) {
            return TRUE;
        } else {
            return FALSE;
        }
    }

    $acc2 = check_Name($Name,$FamName);[/code]
    [/quote]



    this is what i am trying to do


    [code]function emailcheck($Email)
                         {
                                    $email_pattern = '^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$';
                                if (eregi ($email_pattern, $Email) )
                                    {
                                        $ans1 = TRUE;
                                }
                                    else
                                {
                                    $ans1 = FALSE;
                                }
                                    return $ans1;
                        }


                                
                        
                        
                        function check_forFileds($Name,$FamName,$Email)
                        {
                           if((!$Name)||(!$FamName)||(!$Email))
                           {
                                 print("Invalid Input\n");
                                 $ans=FALSE;
                                 }
                                 else
                                     {
                                          $ans=TRUE;
                                      }
                          return $ans;
                          
                          }
                          function check_Name($Name,$FamName)
                          {
                              $Name_Pattern="^[a-zA-Z]+$";
                                if ((eregi("$Name_Pattern",$Name))AND(eregi("$Name_Pattern",$FamName)))
                                        {
                                            $ans2=TRUE;
                                        }
                                else
                                     {
                                          $ans2=FALSE;
                                      }
                          return $ans2;
                        
                        }
                            

                function HandleForm()
                {  
                            
                            $Name=$_POST['fname'];
                            $FamName=$_POST['lname'];
                            $Email=$_POST['mailaddress'];
                            $TheDate=date("j F Y H:i:s");
                            
                            
                                
                                 
                                    if(emailcheck("$Email")==TRUE)
                                    {
                                         $acc=TRUE;
                                         }else{
                                         $acc=FALSE;
                                     }
                                     $acc1=check_forFileds("$Name","$FamName","$Email");
                                    
                                    if(check_Name("$Name","$FamName")==TRUE)
                                    {
                                         $acc2=TRUE;
                                         }else{
                                         $acc2=FALSE;
                                     }
                                                
                                                            if (($acc==TRUE)AND($acc1==TRUE)AND($acc2==TRUE))
                                                            {
                                                                $CallFunction=WriteToFile("$Name","$FamName","$Email","$TheDate");
                                                                print("<b>Thank You For Your Support.</b>");
                                                            }
                                                        
                                                                else
                                                                    {
                                                                        print("<b>Please enter a valid Input !\n</b>");
                                                                    }
                        
                                }      
                                
                                                if(isset($_POST['BeenSubmitted']))
                                                   {
                                                       HandleForm();
                                                   }
                                               CreateForm();
                  
                    ?>[/code]
    I check for the input each at a time using the functions then

    then i AND the result if it true

    i write to the file
    but there is a logical error i think in the name character check

    if anyone can help me
    thank you
  2. Hello All ,

    I have written this function in order to check if the user enters alphabetic characters or numeric;

    function check_Name($Name,$FamName)
    {
    $Name_Pattern="^[a-zA-Z]+$";
    if ((eregi("$Name_Pattern",$Name))AND(eregi("$Name_Pattern",$FamName)))
    {
    $ans2=TRUE;
    }
    else
    {
    $ans2=FALSE;
    }
    return $ans2;

    }



    I am calling this function through this :::
    if(check_Name("$Name","$FamName")==TRUE)
    {
    $acc2=TRUE;
    }else{
    $acc2=FALSE;
    }


    But it is not working correctly can you help me
    thank you
  3. [!--quoteo(post=385948:date=Jun 20 2006, 01:47 PM:name=Orio)--][div class=\'quotetop\']QUOTE(Orio @ Jun 20 2006, 01:47 PM) [snapback]385948[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    if (!eregi("^[a-z]+$",$name)
    {die("Invalid name");};
    [/quote]
    according to your syntax that you gave i tried to write this
    function check_Name($Name,$FamName)
    {
    if ((!eregi("^[a-z]+$",$Name))||(!eregi("^[a-z]+$",$FamName)))
    {
    $ans=FALSE;
    }
    else
    {
    $ans=TRUE;
    }
    return $ans;

    }


    but it is still taking numbers can you tell me if the code up is wrong please thank you
  4. [!--quoteo(post=385892:date=Jun 20 2006, 10:08 AM:name=hackerkts)--][div class=\'quotetop\']QUOTE(hackerkts @ Jun 20 2006, 10:08 AM) [snapback]385892[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    This is what I did, hope you know where you went wrong.
    [code]<?php

    function validateEmail($email)
    {
        $email_pattern = '^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$';
        if (eregi ($email_pattern, $email) )
        {
            $ans1 = TRUE;
        }
        else
        {
            $ans1 = FALSE;
        }
        return $ans1;
    }

    if (validateEmail("hackerkts@gmail.com") == TRUE) {
        echo "TRUE";
        } else {
            echo "FALSE";
            }
    ?>[/code]
    [/quote]


    [!--quoteo(post=385887:date=Jun 20 2006, 08:16 AM:name=Terfanda)--][div class=\'quotetop\']QUOTE(Terfanda @ Jun 20 2006, 08:16 AM) [snapback]385887[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    function emailcheck($Email)
    {
    if (eregi("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$]", $Email))
    {
    $ans1=FALSE;
    }
    else
    {
    $ans1= TRUE;
    }
    return $ans1;

    }

    Hello agian I will be very thankfull if someone help I am using this function up it seems it is wrong can someone tells me where is my mistake

    i am calling it here:::::: $acc=emailcheck("$Email");

    and i am using this if condition to give me a final answer::::: if (($acc==TRUE)AND($acc1==TRUE))
    I will be very greatfull if someone helps me thank you
    [/quote]


    Thank You
    I understood it and i will try it
  5. function emailcheck($Email)
    {
    if (eregi("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$]", $Email))
    {
    $ans1=FALSE;
    }
    else
    {
    $ans1= TRUE;
    }
    return $ans1;

    }




    Hello agian I will be very thankfull if someone help I am using this function up it seems it is wrong can someone tells me where is my mistake

    i am calling it here:::::: $acc=emailcheck("$Email");

    and i am using this if condition to give me a final answer::::: if (($acc==TRUE)AND($acc1==TRUE))


    I will be very greatfull if someone helps me thank you

  6. function CreateForm()
    {

    print("<form action=\"Petition.php\" method=post>\n");
    print("First Name :<input type=text name=\"fname\" size=24 maxlength=32>");
    print(" Last Name :<input type=text name=\"lname\" size=24 maxlength=32><br>\n");
    print(" Email :<input type=text name=\"mailaddress\" size=30 maxlength=60><br>\n");
    print("<input type=hidden name=\"BeenSubmitted\" value=\"TRUE\"><br>\n");
    print("<input type=submit name=\"submit\" value=\"Submit\"></form>\n");
    }

    function emailcheck($Email)
    {
    if (eregi("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$]", $Email))
    {
    $ans1=TRUE;
    }
    else
    {
    $ans1= FALSE;
    }
    return $ans1;

    }



    function check_forFileds($Name,$FamName,$Email)
    {
    if((!$Name)||(!$FamName)||(!$Email))
    {
    print("Invalid Input\n");
    $ans=FALSE;
    }
    else{
    $ans=TRUE;
    }
    return $ans;

    }


    function HandleForm()
    {

    $Name=$_POST['fname'];
    $FamName=$_POST['lname'];
    $Email=$_POST['mailaddress'];
    $TheDate=date("j F Y H:i:s");




    $acc=emailcheck("$Email");
    $acc1=check_forFileds("$Name","$FamName","$Email") ;

    if (($acc==TRUE)AND($acc1==TRUE))
    {
    $CallFunction=WriteToFile("$Name","$FamName","$Email","$TheDate");
    }

    else
    {
    print("Please enter a valid Input !\n");
    }

    }

    if(isset($_POST['BeenSubmitted']))
    {
    HandleForm();
    }
    CreateForm();

    ?>


    The email check function is not wrorking correctly can someone help me or give me another funstion to check emails

    this is the function

    function emailcheck($Email)
    {
    if (eregi("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$]", $Email))
    {
    $ans1=TRUE;
    }
    else
    {
    $ans1= FALSE;
    }
    return $ans1;

    }

    it is called in this line :
    $acc=emailcheck("$Email");

    and checked for the answer in this line :
    if (($acc==TRUE)AND($acc1==TRUE))
    and each time i refresh the page the data on it is resend to the file how can solve it
    if(isset($_POST['BeenSubmitted']))
    {
    HandleForm();
    }
    CreateForm();

    ?>

    how can i reset the form after i submit it

  7. [!--quoteo(post=385783:date=Jun 19 2006, 10:54 PM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Jun 19 2006, 10:54 PM) [snapback]385783[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    I think this:
    if(!isset($_POST['BeenSubmitted']))

    should be:
    if(isset($_POST['BeenSubmitted']))

    As currently it is validating form input when the form hasn't been submitted yet! Thats why you are getting the undefind index notices.
    [/quote]


    First of al thank you
    i did wut you said an i got a new error

    Warning: ereg(): REG_BADRPT if(!ereg("^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$",$Email))


    can you please tell me my mistake
  8. [img src=\"style_emoticons/[#EMO_DIR#]/excl.gif\" style=\"vertical-align:middle\" emoid=\":excl:\" border=\"0\" alt=\"excl.gif\" /]
    [code]
                function CreateForm()
                {
                    
                    print("<form action=\"Petition.php\" method=post>\n");
                    print("First Name :<input type=text name=\"fname\" size=24 maxlength=32>");
                    print(" Last Name  :<input type=text name=\"lname\" size=24 maxlength=32><br>\n");
                    print(" Email   :<input type=text name=\"mailaddress\" size=30 maxlength=60><br>\n");
                    print("<input type=hidden name=\"BeenSubmitted\" value=\"TRUE\"><br>\n");
                    print("<input type=submit name=\"submit\" value=\"Submit\"></form>\n");
                }
                
                        function emailcheck($Email)
                         {
                                     if(!ereg("^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$",$Email))
                                    {
                                        //err.=$Email."is not a valid email address.<br/>";                
                                        $ans=FALSE;
                                    }else{
                                     $ans=TRUE;
                                     }
                                    return $ans;
                                    }
                                
                        
                        
                        function check_forFileds($Name,$FamName,$Email)
                        {
                           if((!$Name)||(!$famName)||(!$Email))
                           {
                                 print("Invalid Input\n");
                                 $ans=FALSE;
                                 }
                                 else{
                                  $ans=TRUE;
                                      }
                          return $ans;
                        }
                            

                function HandleForm()
                {  
                            
                            $Name=$_POST['fname'];
                            $FamName=$_POST['lname'];
                            $Email=$_POST['mailaddress'];
                            $TheDate=date("j F Y H:i:s");
                            
                            
                                
                                 
                                    $acc=emailcheck("$Email");
                                     $acc=check_forFileds("$Name","$FamName","$Email");
                                                      
                                                            if ($acc==TRUE)
                                                            {
                                                                $CallFunction=WriteToFile("$Name","$FamName","$Email","$TheDate");
                                                            }
                                                        
                                                                else
                                                                    {
                                                                        print("Please enter a valid Input !\n");
                                                                    }
                        
                                }      
                                
                                                if(!isset($_POST['BeenSubmitted']))
                                                   {
                                                       HandleForm();
                                                   }
                                               CreateForm();
                  
                    ?>
    [/code]



    I am new athis when i run it
    it is giving me this errors:


    Notice: Undefined index: fname in ->$Name=$_POST['fname'];

    Notice: Undefined index: lname in ->$FamName=$_POST['lname'];
    Notice: Undefined index: mailaddress in ->$Email=$_POST['mailaddress'];
    Warning: ereg(): REG_BADRPT in ->if(!ereg("^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$",$Email))


    I Appreciate your help
    thank you in advance

    [b]EDITED BY WILDTEEN88: PLEASE USE THE CODE TAGS WHEN SUBMITTING BLOCKS OF CODE[/b]
  9. [!--quoteo(post=385328:date=Jun 18 2006, 07:28 PM:name=Crayon Violent)--][div class=\'quotetop\']QUOTE(Crayon Violent @ Jun 18 2006, 07:28 PM) [snapback]385328[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    mind telling us what the error is?
    [/quote]


    Sorry The Error is here : Parse error: parse error
    if(($Name=="" OR FamName=="")OR((eregi("^[a-zA-Z]+$",$Name)) OR (eregi("^[a-zA-Z]+$",$FamName))))


  10. HI All

    i have written this function to create a form


    function CreateForm()
    {

    print("<form action=\"Petition.php\" method=post>\n");
    print("First Name :<input type=text name=\"fname\" size=24 maxlength=32>");
    print(" Last Name :<input type=text name=\"lname\" size=24 maxlength=32><br>\n");
    print(" Email :<input type=text name=\"mailaddress\" size=30 maxlength=60><br>\n");
    print("<input type=hidden name=\"BeenSubmitted\" value=\"TRUE\"><br>\n");
    print("<input type=submit name=\"submit\" value=\"Submit\"></form>\n");
    }


    I need to know how can validate : fname, lname (check if they are empty or filled with numbers)
    and check if the email entered is in the correct form

    Thank you in advance
  11. *************************************************************************
    function emailcheck($Email)
    {
    $theresults = ereg("^[^@ ]+@[^@ ]+\.[^@ \.]+$", $intext, $trashed);
    if ($theresults) {
    $isamatch = TRUE;
    }
    else
    {
    $isamatch =FALSE;
    }
    return $ismatch;
    }

    function HandleForm()
    {

    $Name=$_POST['fname'];
    $FamName=$_POST['lname'];
    $Email=$_POST['mailaddress'];
    $TheDate=date("j F Y H:i:s");




    $acc=emailcheck("$Email")

    if(($Name=="" OR FamName=="")OR((eregi("^[a-zA-Z]+$",$Name)) OR (eregi("^[a-zA-Z]+$",$FamName))))
    {
    $acc=FALSE;
    }
    else
    {
    $acc=TRUE;
    }
    if ($acc==TRUE)
    {
    $CallFunction=WriteToFile("$Name","$FamName","$Email","$TheDate");
    }
    else
    {
    print("Please enter a valid Input !\n");
    }

    }
    ***************************************************************************************

    this 2 function should check for if the user has enter his name and last name and if he didnt put nay number in them
    and the email check if the user has enter a valid email syntax


    these are what they are supposed to do but they are giving error
    if anyone can help me i will be greatfull
    and thank you in advance
    if anyone has a simpler way to check for an email and the name last name input and would like to tell me
    i am again thankfull


    Sorry The Error is here : Parse error: parse error
    if(($Name=="" OR FamName=="")OR((eregi("^[a-zA-Z]+$",$Name)) OR (eregi("^[a-zA-Z]+$",$FamName))))






×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.