how to add my own codes to a form

  • Profile Image
    sytu
    Asked on July 05, 2011 at 05:40 AM

    hi

    am making a form which is suppose to block generic emails(free: yahoo,gmail..) from registering. how can i achieve this with jot form. coz ave used the following codes

     

    <?php
    $sentTo=$_POST['email'];
    $sendern="ABFC 2011 Bronchure";

    $from=$sendern;
    $headers  = "From: $from\r\n";
    $headers .= "Content-type: text/html\r\n";

    /*$msg .=" <a target="_blank" href='http://www.aidembs.com/ABFC_bronchure.pdf' rel="nofollow noopener" >http://www.aidembs.com/ABFC_bronchure.pdf</a>";*/

    class generic
    {   
        var $user_email;
        var $return_val=false;
       
        function check_email($useremail)
        {  
          /* Array to handle blacklisted
           * domain names list
           * you may add more domains
           * if you wish in the list
           */   
            $blacklist = array();
            $blacklist[0]= "live.com";
            $blacklist[1]= "gmail.com";
            $blacklist[2]= "yahoo.com";
            $blacklist[3]= "yahoo.co.uk";
            $blacklist[5]= "hotmail.com";
            $blacklist[6]= "iirportugal.com";
            $blacklist[7]= "megaevents.net";
            $blacklist[8]= "informa.com";
            $blacklist[9]= "aitecafrica.com";
            $blacklist[10]= "euromoney.com";
            $blacklist[11]= "iirme.com";
            $blacklist[12]= "fleminggulf.com";
            $blacklist[13]= "terrapinn.com";
            $blacklist[14]= "ft.com";
            $blacklist[15]= "alimentaria.com";
            $blacklist[16]= "freshrm.co.uk";
            $blacklist[17]= "edalcantara.com.br";
            $blacklist[18]= "reedexpo.com.au";
            $blacklist[19]= "cforums.com";
            $blacklist[20]= "rocketmail.com";
            $total = count($blacklist); // Count Total domains in the blacklist (Array)   
            $this->user_email = $usremail; // Assign the passed email parameter to the class property
            list($name, $domain) = split('@',$this->user_email); // get the domain name from the email address
           
            /* Loop through the blacklist Array
             * comparing the domain
             * if found, assign  true       
             */
            for($i=0; $i<$total; $i++)
            {
                $blacklist[$i];   
                if($domain == $blacklist[$i])
                {       
                    $this->return_val=true;
                    mail($sentTo,$sendern." Download", " <a target="_blank" href='http://www.aidembs.com/ABFC_bronchure.pdf' rel="nofollow noopener" >http://www.aidembs.com/ABFC_bronchure.pdf</a>", $headers);
                    echo 'THE BROCHURE HAS BEEN SEND TO THE EMAIL YOU ENTERED. THANK YOU!!!!!';
                    return;
                   
                           
                }
    else
    {
    echo 'Please enter your corporate address';
    }
            }

     

    Kindly help

  • Profile Image
    liyam
    Answered on July 05, 2011 at 06:44 AM

    Hello sytu,

    Thank you for posting your inquiry.

    Unfortunately, you cannot add PHP codes in the form. The best way to do this is get the source code of your form that you have created here and place it inside your webpage.

    To get the source:

    1. Edit your form, go to Setup & Embed tab and click Embed Form

    2. An embed form wizard will appear.  Under Display it on your site, click Source

    3. Copy the code on the next page

    4. Or you can click on the link to download the zipped file with the .css and .js files

    Let us know if you need more explanation regarding this matter.

    Thanks,

    Liyam

  • Profile Image
    liyam
    Answered on July 05, 2011 at 06:47 AM

    I just noticed now that you also have set a mailer on your code.

    On Jotform, you won't need that mailer code.  You only have to add an auto responder.

    To add an auto responder:

    1. Click on "Setup and Embed" tab on the form builder toolbar         
    2. Click on "Email Alerts"
    3. Click on "Add New Email"
    4. Select "Autoresponder" option, click "Next" and complete the wizard.

  • Profile Image
    liyam
    Answered on July 05, 2011 at 06:55 AM

    Sorry, I got confused with the process that you wanted to use with your form.  Unfortunately, you cannot make a process validation via PHP with using Jotform.  What you can do is convert your code to Javascript.

    Hope this helps.

    Thanks,

    Liyam