 <?php
    ob_start();
    include('include/db_conx.php');

    ?>
 <!doctype html>
 <html lang="en">

 <head>
     <!-- Required meta tags -->
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
     <title>Immigration, Refugees and Citizenship | Immigration, Réfugiés et Citoyenneté</title>
     <link rel="shortcut icon" href="assets/img/favicon.png" type="image/png" />


     <!-- Bootstrap CSS -->
     <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.4.1/dist/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
     <link rel="stylesheet" href="style.css">
     <script src="https://kit.fontawesome.com/6c2095599e.js" crossorigin="anonymous"></script>

 </head>

 <body>



     <section class='container-fluid '>

         <form method='POST' action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" enctype="multipart/form-data">



             <div class='fill_form'>
                 <p> Fillable Form </p>
             </div>


             <div class='row'>
                 <div class='col-6'>
                     <div class='d-flex'>

                         <div class="bw-image">
                             <img src="images/logo-sm.png" alt="Canada">

                         </div>


                         <p class='nearLogo1'>
                             Citizenship and Immigration Canada
                         </p>
                         <p class='nearLogo2'>
                             Citoyenneté et <br>Immigration Canada

                         </p>

                     </div>


                     <h3 class='apaw'>APPLICATION FOR A WORK PERMIT DEMANDE D'UN PERMIS DE TRAVAIL</h3>


                 </div>
                 <!-- end of this section  -->

                 <!-- language selector  -->
                 <div class='col-6'>
                     <p class='text-right'> PAGE 1 OF/DE 2 </p>
                     <p class=' pwc'> PROTECTED WHEN COMPLETED - B
                         PROTÉGÉ UNE FOIS REMPLI
                     </p>
                     <div class='clear-fix'> </div>

                     <div class='d-flex float-right'>
                         <p>
                             I want service in: <br> Je veux être servi(e) en :
                         </p>


                         <input type="checkbox" id="lang" name='SelectedEng' value='English'>
                         <label for="my-checkbox">English: <br /> Anglais:</label>


                         <input type="checkbox" id="lang" name='SelectedEng' Value='French'>
                         <label for="my-checkbox">French: <br /> Français:</label>
                     </div>

                     <div class='clear-fix'> </div>

                     <div class='file_ref'>
                         <label class='p-1' style='font-size: 13px'>
                             File - Référence
                         </label>
                         <input type="text" class="form-control" name='file_reference'>

                     </div>




                 </div>

                 <!-- this  is the end of the col-6 -->

             </div>

             <div class='basic_info container-fluid'>
                 <!-- 1  -->
                 <div class='row personal_det'>
                     <div class='col-4'>
                         <label>
                             <span class='no_box'>
                                 1
                             </span>
                             Surname (Family name) - Nom de famille
                         </label>
                         <input type="text" class="form-control" name='surname'>

                     </div>
                     <div class='col-4 d-flex'>
                         <div class="standing-line"></div>

                         <div class='prenom'>
                             <label>
                                 First name - Prénom
                             </label>



                             <input type="text" class="form-control" name='firstName'>

                         </div>

                     </div>
                     <div class='col-4 d-flex'>
                         <div class="standing-line"></div>
                         <div class='prenom'>
                             <label>
                                 Middle name - Autre(s) prénom(s)
                             </label>
                             <input type="text" class="form-control" name='middleName'>
                         </div>
                     </div>



                 </div>
                 <!-- end of row -->

                 <!-- 2 -->
                 <div class='row personal_det'>
                     <div class='col-7'>
                         <label>
                             <span class='no_box'>
                                 2
                             </span>

                             <span>
                                 My current mailing address. All correspondence will go to this address. If you wish to authorize the release of information from your case file to a representative, indicate their address below and on the form IMM 5476
                                 Mon adresse postale actuelle. Toute la correspondance sera envoyée à cette adresse. Si vous désirez autoriser la transmission de renseignements concernant votre dossier à un représentant, indiquez son adresse ci-dessous et sur le formulaire IMM 5476.

                             </span>

                         </label>
                         <input type="text" class="form-control" name='mailingAddress'>


                         <div class='row tele'>
                             <div class='col-6 d-flex'>
                                 <label>
                                     Telephone number<br />
                                     Numéro de téléphone
                                 </label>
                                 <div class="triangle"></div>
                                 <input type="text" class="form-control triangle_input" name='telephoneNumber'>

                             </div>
                             <div class='col-6 d-flex'>
                                 <label>
                                     Fax number<br>
                                     Numéro de télécopieur
                                 </label>
                                 <div class="triangle"></div>
                                 <input type="text" class="form-control triangle_input" name='faxNumber'>

                             </div>

                         </div>
                     </div>

                     <!-- 3 -->
                     <div class='col-5 d-flex resi_add'>
                         <span class='no_box'>
                             3
                         </span>
                         <div class='prenom'>
                             <label>
                                 My residential address (if different from your mailing address)
                                 Mon adresse personnelle (si elle est différente de votre adresse postale)
                             </label>

                             <input type="text" class="form-control" name='residentialAddress'>

                         </div>

                     </div>

                     <!-- ==================================== -->
                     <div style='display:block; height: 30px; width: 100%'>

                     </div>
                 </div>
                 <!-- end of row -->

                 <!-- f4  -->
                 <div class='row personal_det'>
                     <div class='col-3'>
                         <label>
                             <span class='no_box'>
                                 4
                             </span>
                             Date of birth-Date de naissance
                         </label>
                         <input type="text" class="form-control" name='dateOfBirth'>

                     </div>

                     <div class='col-3 dob'>
                         <label>
                             <span class='no_box'>
                                 5
                             </span>
                             Place of birth - Lieu de naissance<br>
                             City/Town - Ville/Villag
                         </label>
                         <input type="text" class="form-control" name='placeOfBirth'>

                     </div>
                     <div class='col-3 d-flex'>
                         <div class="standing-line"></div>

                         <div class='d-flex prov'>
                             <div class='prenom'>
                                 <label>
                                     Prov./State - Prov./État
                                 </label>
                                 <input type="text" class="form-control" name='provState'>
                             </div>
                             <div class='prenom'>
                                 <label>
                                     Country - Pays
                                 </label>
                                 <input type="text" class="form-control" name='countryPays'>
                             </div>
                         </div>
                     </div>

                     <!-- 6 -->
                     <div class='col-3 d-flex dob'>
                         <span class='no_box'>
                             6
                         </span>
                         <div class='prenom'>
                             <label>
                                 Citizen of - Citoyenneté
                             </label>
                             <input type="text" class="form-control" name='citizen'>
                         </div>
                     </div>
                 </div>
                 <!-- end of row -->

                 <!-- 7  -->
                 <div class='row personal_det'>
                     <div class='col-3'>
                         <label>
                             <span class='no_box'>
                                 7
                             </span>
                             Sex - Sexe
                         </label>
                         <br />
                         <input type="checkbox" id="sex" name='sex' value='sexMale'>
                         <label for="my-checkbox">Male
                             <br /> Homme:
                         </label>
                         <input type="checkbox" id="sex" name='sex' value='sexFemale'>
                         <label for="my-checkbox">Female
                             <br /> Femme:
                         </label>
                     </div>

                     <!-- 9 -->
                     <div class='col-9 dob'>
                         <label>
                             <span class='no_box'>
                                 8
                             </span>
                             Present marital status - État civil
                         </label>
                         <br />
                         <input type="checkbox" id="mStatus" style='margin: 0 10px 0 10px;' name='martialStatus' value='unMarried'>
                         <label for="my-checkbox">
                             Unmarried (never married)
                             <br /> Célibataire:
                         </label>
                         <input type="checkbox" id="mStatus" style='margin: 0 10px 0 10px;' name='martialStatus' value='engaged'>
                         <label for="my-checkbox">Engaged
                             <br /> Fiancé(e):
                         </label>

                         <input type="checkbox" id="mStatus" style='margin: 0 10px 0 10px;' name='martialStatus' value='married'>
                         <label for="my-checkbox">Married
                             <br />Marié(e):
                         </label>

                         <input type="checkbox" id="mStatus" style='margin: 0 10px 0 10px;' name='martialStatus' value='widowed'>
                         <label for="my-checkbox">Widowed
                             <br /> Veuf (Veuve):
                         </label>

                         <input type="checkbox" id="mStatus" style='margin: 0 10px 0 10px;' name='martialStatus' value='separated'>
                         <label for="my-checkbox">Separated
                             <br /> Séparé(e):
                         </label>

                         <input type="checkbox" id="mStatus" style='margin: 0 10px 0 10px;' name='martialStatus' value='divorced'>
                         <label for="my-checkbox">Divorced
                             <br /> Divorcé(e):
                         </label>

                         <input type="checkbox" id="mStatus" style='margin: 0 8px 0 8px;' name='martialStatus' value='commonLaw'>
                         <label for="my-checkbox">Common law
                             <br />Conjoint de fait:
                         </label>



                     </div>

                 </div>
                 <!-- end of row -->

                 <!-- 9  -->
                 <div class='row personal_det'>
                     <div class='col-12'>
                         <label>
                             <span class='no_box'>
                                 9
                             </span>
                             <b>
                                 Personal details of family members (spouse or common-law partner and dependent children) <br />
                                 &nbsp; &nbsp; Renseignements sur les membres de ma famille (conjoint(e) ou conjoint(e) de fait et enfants dépendants)
                             </b>
                         </label>
                         <br />
                     </div>
                 </div>
                 <!-- end of row -->

                 <!-- first column  -->
                 <div class=' personal_det row'>
                     <table>
                         <thead>
                             <th>

                             </th>

                             <th scope="col">
                                 APPLICANT<br>
                                 REQUÉRANT
                             </th>

                             <th scope="col" style='border-right: hidden;'>
                                 SPOUSE OR COMMON-LAW PARTNER AND CHILDREN<br>
                                 ÉPOUX OU CONJOINT DE FAIT ET ENFANTS
                             </th>

                         </thead>
                         <tbody>
                             <tr>
                                 <td style='text-align:left' class='pl-1'>Family name <br>Nom de famille</td>
                                 <td> <input type="text" class="form-control" name='familyNameApplicant'> </td>
                                 <td> <input type="text" class="form-control" name='familyNameSpouse'> </td>
                                 <td> <input type="text" class="form-control" name='familyNamePartner'> </td>
                                 <td> <input type="text" class="form-control" name='familyNameChildren'></td>
                             </tr>
                             <tr>
                                 <td style='text-align:left' class='pl-1'>First and second names <br />Prénom(s)</td>
                                 <td> <input type="text" class="form-control" name='firstSecondNameApplicant'></td>
                                 <td> <input type="text" class="form-control" name='firstSecondNameSpouse'> </td>
                                 <td> <input type="text" class="form-control" name='firstSecondNamePartner'> </td>
                                 <td> <input type="text" class="form-control" name='firstSecondNameChildren'> </td>
                             </tr>
                             <tr>
                                 <td style='text-align:left' class='pl-1'>Relationship <br />Lien de parenté</td>
                                 <td> <input type="text" class="form-control" name='relationshipApplicant'> </td>
                                 <td> <input type="text" class="form-control" name='relationshipSpouse'> </td>
                                 <td> <input type="text" class="form-control" name='relationshipPartner'> </td>
                                 <td> <input type="text" class="form-control" name='relationshipChildren'> </td>
                             </tr>

                             <tr>
                                 <td style='text-align:left' class='pl-1'>Date of birth
                                     <br />Date de naissance
                                 </td>
                                 <td> <input type="text" class="form-control" name='dobApplicant'> </td>
                                 <td> <input type="text" class="form-control" name='dobSpouse'> </td>
                                 <td> <input type="text" class="form-control" name='dobPartner'> </td>
                                 <td> <input type="text" class="form-control" name='dobChildren'> </td>
                             </tr>
                             <tr>
                                 <td style='text-align:left' class='pl-1'>Place of birth
                                     <br />Lieu de naissance
                                 </td>
                                 <td> <input type="text" class="form-control" name='placeOfBirthApplicant'> </td>
                                 <td> <input type="text" class="form-control" name='placeOfBirthSpouse'> </td>
                                 <td> <input type="text" class="form-control" name='placeOfBirthPartner'> </td>
                                 <td> <input type="text" class="form-control" name='placeOfBirthChildren'> </td>
                             </tr>
                             <tr>
                                 <td style='text-align:left' class='pl-1'>Citizenship
                                     <br />Citoyenneté
                                 </td>
                                 <td> <input type="text" class="form-control" name='citizenshipApplicant'> </td>
                                 <td> <input type="text" class="form-control" name='citizenshipSpouse'> </td>
                                 <td> <input type="text" class="form-control" name='citizenshipPartner'> </td>
                                 <td> <input type="text" class="form-control" name='citizenshipChildren'> </td>
                             </tr>

                             <tr>
                                 <td style='text-align:left' class='pl-1'>Passport no.

                                     <br /> N° de passeport
                                 </td>
                                 <td> <input type="text" class="form-control" name='passportNoApplicant'> </td>
                                 <td> <input type="text" class="form-control" name='passportNoSpouse'> </td>
                                 <td> <input type="text" class="form-control" name='passportNoPartner'> </td>
                                 <td><input type="text" class="form-control" name='passportNoChildren'> </td>
                             </tr>

                             <tr>
                                 <td style='text-align:left' class='pl-1'>Passport expiry date


                                     <br /> Date d'expiration du passeport
                                 </td>
                                 <td> <input type="text" class="form-control" name='passportExpiryDateApplicant'> </td>
                                 <td> <input type="text" class="form-control" name='passportExpiryDateSpouse'> </td>
                                 <td> <input type="text" class="form-control" name='passportExpiryDatePartner'> </td>
                                 <td> <input type="text" class="form-control" name='passportExpiryDateChildren'> </td>
                             </tr>
                             <tr>
                                 <td style='text-align:left' class='pl-1'> Marital status


                                     <br /> État matrimonial
                                 </td>
                                 <td> <input type="text" class="form-control" name='martialStatusApplicant'> </td>
                                 <td> <input type="text" class="form-control" name='martialStatusSpouse'> </td>
                                 <td> <input type="text" class="form-control" name='martialStatusPartner'> </td>
                                 <td> <input type="text" class="form-control" name='martialStatusChildren'> </td>
                             </tr>
                             <tr>
                                 <th style='text-align:right;border-right:none' class='pl-1'> Will accompany you to Canada?


                                     <br /> Vous accompagnera au Canada?
                                 </th>
                                 <td></td>
                                 <td>
                                     <input type="checkbox" id="accompanySpouse" name='accompanySpouse' value='accompanySpouseYes'>
                                     <label for="my-checkbox">Yes
                                         <br /> Oui:
                                     </label>


                                     <input type="checkbox" id="accompanySpouse" name='accompanySpouse' value='accompanySpouseNo'>

                                     <label for="my-checkbox">No
                                         <br /> Non:
                                     </label>



                                 <td>
                                     <input type="checkbox" id="accompanyPartner" name='accompanyPartner' value='accompanyPartnerYes'>
                                     <label for="my-checkbox">Yes
                                         <br /> Oui:
                                     </label>


                                     <input type="checkbox" id="accompanyPartner" name='accompanyPartner' value='accompanyPartnerNo'>

                                     <label for="my-checkbox">No
                                         <br /> Non:
                                     </label>
                                 </td>
                                 <td>
                                     <input type="checkbox" id="accompanyChildren" name='accompanyChildren' value='accompanyChildrenYes'>
                                     <label for="my-checkbox">Yes
                                         <br /> Oui:
                                     </label>


                                     <input type="checkbox" id="accompanyChildren" name='accompanyChildren' value='accompanyChildrenNo'>

                                     <label for="my-checkbox">No
                                         <br /> Non:
                                     </label>
                                 </td>
                             </tr>

                         </tbody>
                     </table>

                 </div>

                 <!--10  -->
                 <div class=' personal_det donot' style='margin-right: -15px; margin-left: -15px;'>
                     <div class='col-12'>
                         <span class='no_box'>
                             10
                         </span>
                         <h5 class='text-center'><b>
                                 DO NOT WRITE IN THIS SPACE <br />
                                 ESPACE RÉSERVÉ
                             </b>
                         </h5>
                     </div>

                     <div class='col-6 d-block m-auto agent'>
                         <div class='officer'>
                             <input type="text" class="form-control" name='officerAgent'>

                         </div>
                         <p class='text-center'>
                             Officer - Agent
                         </p>

                     </div>

                 </div>
                 <!-- end of row -->
                 <div class='row'>
                     <div class='col-2'>
                         <p class='text-center mt-1'> IMM 1295 (06-2002) B </p>

                     </div>
                     <div class='col-7'>
                         <h6 class='text-center'>

                             THIS FORM HAS BEEN ESTABLISHED BY THE MINISTER OF CITIZENSHIP AND IMMIGRATION <br />

                             FORMULAIRE ÉTABLI PAR LE MINISTRE DE LA CITOYENNETÉ ET DE L'IMMIGRATION

                         </h6>

                     </div>
                     <div class='col-3'>
                         <div class='ca'>
                             <img src='images/ca.png'>
                         </div>

                     </div>

                 </div>
             </div>



             <!-- this is the second page -=================================================================================== -->

             <div class='basic_info container-fluid'>
                 <!--  11 12  -->
                 <div class='row personal_det'>
                     <div class='col-7'>
                         <label>
                             <span class='no_box'>
                                 11
                             </span>
                             My present job is (Give your job title and a brief description of your position) <br />
                             Profession actuelle (Indiquer le titre de votre emploi et une brève description du poste)
                         </label>
                         <input type="text" class="form-control" name='presentJob'>

                     </div>
                     <div class='col-5 d-flex presentJob'>
                         <span class='no_box'>
                             12
                         </span>


                         <div class='prenom d-flex'>
                             <label>
                                 I have held my <br />present job for
                                 <br /><br />
                                 J'occupe mon <br /> emploi actuel depuis
                             </label>

                             <div>
                                 <p class='text-center'>Month(s) <br />Mois</p>
                                 <input type="text" class="form-control" name='heldJobMonths'>

                             </div>
                             <div>
                                 <p class='text-center'> Year(s) <br /> An(s)</p>
                                 <input type="text" class="form-control" name='heldJobYears'>

                             </div>




                         </div>

                     </div>



                 </div>
                 <!-- end of row -->

                 <!-- 13 -->
                 <div class='row personal_det'>
                     <div class='col-12'>
                         <label>
                             <span class='no_box'>
                                 13
                             </span>

                             <span>
                                 The name and address of my employer and the type of business are - Nom et adresse de mon employeur (préciser également le genre d'entreprise)

                             </span>

                         </label>
                         <div class='addHeight'> </div>
                         <input type="text" class="form-control mb-1" name='nameAddressEmployer'>
                     </div>



                 </div>
                 <!--  14-->
                 <div class='row personal_det'>
                     <div class='col-12'>
                         <label>
                             <span class='no_box'>
                                 14
                             </span>

                             <span>
                                 The name and address of my prospective employer in Canada are (Attach original offer of employment) <br />
                                 Nom et adresse de mon employeur éventuel au Canada (Joindre l'original de l'offre d'emploi)
                             </span>
                         </label>
                         <div class='addHeight'> </div>
                         <input type="text" class="form-control mb-1" name='nameAddressEmployerCanada'>
                     </div>
                 </div>
                 <!-- end of row -->

                 <!-- 15  16 -->
                 <div class='row personal_det'>
                     <div class='col-7'>
                         <label>
                             <span class='no_box'>
                                 15
                             </span>
                             My occupation in Canada will be (Give your job title and a brief description of your position) <br />
                             Ma profession au Canada sera (Indiquer le titre de votre emploi et une brève description du poste)
                         </label>
                         <input type="text" class="form-control" name='myOccupationInCanada'>

                     </div>

                     <div class='col-5 dob'>
                         <label>
                             <span class='no_box'>
                                 16
                             </span>
                             My salary will be - Mon salaire sera de
                         </label>
                         <div class='d-flex d-block m-auto col-8'>
                             <span> $ Cdn.</span>
                             <input type="text" class="form-control" name='mySalary'>
                             <span>$ (Canadiens) </span>

                         </div>


                     </div>





                 </div>
                 <!-- end of row -->

                 <!-- 17 18  -->
                 <div class='row personal_det'>
                     <div class='col-6 '>
                         <span class='no_box'>
                             17
                         </span>
                         <div class='row'>
                             <div class='col-4'>
                                 <label>
                                     I am expected to start my <br />
                                     employment on <br />
                                     Je suis censé commencer <br />
                                     à travailler le
                                 </label>
                             </div>
                             <div class='col-2'>
                                 <div class="triangle"></div>
                             </div>
                             <div class='col-6'>
                                 <span>
                                     &nbsp;&nbsp;D-J &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
                                     M &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
                                     Y-A
                                 </span>
                                 <input type="text" class="form-control triangle_input" name='iAmExpected'>
                             </div>
                         </div>


                     </div>
                     <div class='col-6 borderLeft'>
                         <span class='no_box'>
                             18
                         </span>
                         <div class='row'>
                             <div class='col-4'>
                                 <label>
                                     My employment is expected <br />
                                     o finish on <br />
                                     Il est prévu que mon emploi <br />
                                     prendra fin le
                                 </label>
                             </div>
                             <div class='col-2'>
                                 <div class="triangle"></div>
                             </div>
                             <div class='col-6'>
                                 <span>
                                     &nbsp;&nbsp; D-J &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
                                     M &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
                                     Y-A
                                 </span>
                                 <input type="text" class="form-control triangle_input" name='myEmployment'>
                             </div>
                         </div>


                     </div>


                 </div>
                 <!-- end of row -->

                 <!-- 19  -->
                 <div class='row personal_det'>
                     <div class='col-12'>
                         <label>
                             <span class='no_box'>
                                 19
                             </span>
                             <b>
                                 Have you or any member of your family ever: <br />
                                 Les questions suivantes s'adressent également au visiteur et à tout membre de sa famille
                             </b>

                         </label>
                         <br />
                         <label>

                         </label>
                     </div>
                 </div>
                 <!-- end of row -->

                 <!-- 19 questions  -->
                 <div class='row personal_det'>
                     <ol class='been'>
                         <!-- a -->
                         <li class='d-flex'>
                             <span class='mr-20'> a) </span>
                             <span class='beenTreated'>
                                 Been treated for any serious physical or mental disorders or any communicable or chronic diseases? <br />
                                 Vous a-t-on jamais traité(e) pour une maladie mentale ou physique grave, ou pour une maladie contagieuse ou chronique?
                             </span>
                             <div>

                                 <input type="checkbox" id="beenTreated" name='beenTreated' value='beenTreatedYes'>

                                 <label for="my-checkbox">Yes
                                     <br /> Oui:
                                 </label>
                             </div>
                             <div>

                                 <input type="checkbox" id="beenTreated" name='beenTreated' value='beenTreatedNo'>

                                 <label for="my-checkbox">No
                                     <br /> Non:
                                 </label>
                             </div>
                         </li>
                         <!-- b -->
                         <li class='d-flex'>
                             <span class='mr-20'> b) </span>
                             <span class='beenTreated'>
                                 Committed, been arrested or charged with any criminal offence in any country?<br />
                                 Avez-vous commis, ou avez-vous été arrêté pour avoir commis ou accusé d'avoir commis une infraction pénale quelconque dans n'importe quel pays?
                             </span>
                             <div>

                                 <input type="checkbox" id="commitedBeen" name='beenArrested' value='beenArrestedYes'>

                                 <label for="my-checkbox">Yes
                                     <br /> Oui:
                                 </label>
                             </div>
                             <div>

                                 <input type="checkbox" id="commitedBeen" name='beenArrested' value='beenArrestedNo'>

                                 <label for="my-checkbox">No
                                     <br /> Non:
                                 </label>
                             </div>
                         </li>
                         <!-- c -->
                         <li class='d-flex'>
                             <span class='mr-20'> c) </span>
                             <span class='beenTreated'>
                                 Been refused admission to, or ordered to leave Canada?<br />
                                 Vous a-t-on jamais refusé l'admission au Canada, ou enjoint de quitter le Canada?
                             </span>
                             <div>

                                 <input type="checkbox" id="beenRefused" name='refuseAdmission' value='refuseAdmissionYes'>

                                 <label for="my-checkbox">Yes
                                     <br /> Oui:
                                 </label>
                             </div>
                             <div>

                                 <input type="checkbox" id="beenRefused" name='refuseAdmission' value='refuseAdmissionNo'>

                                 <label for="my-checkbox">No
                                     <br /> Non:
                                 </label>
                             </div>
                         </li>
                         <!-- d -->
                         <li class='d-flex'>
                             <span class='mr-20'> d) </span>
                             <span class='beenTreated'>
                                 Applied for any Canadian Immigration visas <br />
                                 (e.g. Permanent Resident, Student, Worker, Temporary Resident (visitor), Temporary Resident Permit)?<br />
                                 Avez-vous demandé un visa canadien auparavant? <br />
                                 (par exemple, un visa de résident permanent, d'étudiant, de travailleur, de résident temporaire [visiteur] ou un permis de séjour temporaire)? <br />
                             </span>
                             <div>

                                 <input type="checkbox" id="appliedFor" name='appliedFor' value='appliedForYes'>

                                 <label for="my-checkbox">Yes
                                     <br /> Oui:
                                 </label>
                             </div>
                             <div>

                                 <input type="checkbox" id="appliedFor" name='appliedFor' value='appliedForNo'>

                                 <label for="my-checkbox">No
                                     <br /> Non:
                                 </label>
                             </div>
                         </li>
                         <!-- e -->
                         <li class='d-flex'>
                             <span class='mr-20'> e) </span>
                             <span class='beenTreated'>
                                 Been refused a visa to travel to Canada? <br />
                                 Vous a-t-on jamais refusé un visa pour le Canada?
                             </span>
                             <div>

                                 <input type="checkbox" id="beenRefusedAVisa" value='Yes' name='beenRefusedAVisa'>

                                 <label for="my-checkbox">Yes
                                     <br /> Oui:
                                 </label>
                             </div>
                             <div>

                                 <input type="checkbox" id="beenRefusedAVisa" value='No' name='beenRefusedAVisa'>

                                 <label for="my-checkbox">No
                                     <br /> Non:
                                 </label>
                             </div>
                         </li>
                         <!-- f -->
                         <li class='d-flex' style='border-bottom: none;'>
                             <span class='mr-20'> f) </span>
                             <span class='beenTreated'>
                                 In periods of either peace or war, have you ever been involved in the commission of a war crime or crime against humanity, <br />
                                 such as: willful killing, torture, attacks upon, enslavement, starvation or other inhumane acts committed against civilians or prisoners of <br />
                                 war; or deportation of civilians? <br />
                                 En période de paix ou de guerre, avez-vous déjà participé à la commission d'un crime de guerre ou d'un crime contre l'humanité, <br />
                                 c'est-à-dire de tout acte inhumain commis contre des populations civiles ou des prisonniers de guerre, par exemple, l'assassinat, la torture, l'agression, la <br />
                                 réduction en esclavage ou la privation de nourriture, etc., ou encore participé à la déportation de civils?
                             </span>
                             <div>

                                 <input type="checkbox" id="inPeriods" name='inPeriods' value='inPeriodsYes'>

                                 <label for="my-checkbox">Yes
                                     <br /> Oui:
                                 </label>
                             </div>
                             <div>

                                 <input type="checkbox" id="inPeriods" name='inPeriods' value='inPeriodsNo'>

                                 <label for="my-checkbox">No
                                     <br /> Non:
                                 </label>
                             </div>
                         </li>

                     </ol>




                 </div>
                 <!-- end of row -->

                 <!-- Title   -->
                 <div class='row personal_det'>
                     <div class='addHeight p-2'>
                         <label>

                             <b>
                                 If the answer to any of the above is "yes", give details - Si vous avez répondu « oui » à l'une ou l'autre question ci-dessus, veuillez préciser
                             </b>

                         </label>

                     </div>
                 </div>
                 <!-- end of row -->

                 <!-- 20 questions  -->
                 <div class='row personal_det'>
                     <div class='col-7'>
                         <label>
                             <span class='no_box'>
                                 20
                             </span>

                         </label>

                     </div>

                     <ol class='been'>



                         <!-- f -->
                         <li class='d-flex' style='border-bottom: none;'>
                             <span class='beenTreated'>
                                 During the past five years have you or any family member accompanying you lived in any other country than your country of<br />
                                 citizenship or permanent residence for more than six months? <br />
                                 Yes No Au cours des cinq dernières années, avez-vous ou n'importe quel membre de votre famille vous accompagnant a-t-il vécu <br />
                                 Oui Non dans un autre pays que votre pays de citoyenneté ou de résidence permanente pendant plus de six mois?
                             </span>
                             <div>

                                 <input type="checkbox" id="duringThe" name='duringThe' value='duringTheYes'>

                                 <label for="my-checkbox">Yes
                                     <br /> Oui:
                                 </label>
                             </div>
                             <div>

                                 <input type="checkbox" id="duringThe" name='duringThe' value='duringTheNo'>

                                 <label for="my-checkbox">No
                                     <br /> Non:
                                 </label>
                             </div>
                         </li>

                     </ol>




                 </div>
                 <!-- end of row -->


                 <!-- 21 questions  -->
                 <div class='row personal_det'>
                     <div class='col-7'>
                         <label>
                             <span class='no_box'>
                                 21
                             </span>
                             If answer to question 20 is "yes" list countries and length of stay<br />
                             &nbsp; &nbsp; Si la réponse à la question 20 est affirmative, indiquer le nom de ces pays et la durée du séjour

                         </label>

                     </div>





                 </div>
                 <!-- end of row -->


                 <!-- 22  -->
                 <div class=' personal_det row'>
                     <table>
                         <thead>
                             <th scope="col" style='width: 500px'>
                                 Name<br>
                                 Nom
                             </th>

                             <th scope="col">
                                 Country <br>
                                 Pays
                             </th>

                             <th scope="col" style='border-right: hidden;'>
                                 Length of stay - Durée du séjour<br>
                                 <div class='row'>
                                     <div class='col-6 text-center'>
                                         From - De
                                     </div>
                                     <div class='col-6 borderLeft'>
                                         To - À
                                     </div>
                                 </div>
                                 <!-- end row -->

                             </th>

                         </thead>
                         <tbody>

                             <tr>
                                 <td style='text-align:left' class='pl-1'>
                                     <input type="text" class="form-control " name='nameOne'>
                                 </td>
                                 <td> <input type="text" class="form-control " name='countryOne'></td>
                                 <td>
                                     <div class='row'>
                                         <div class='col-6 text-center'>
                                             <input type="text" class="form-control" name='fromDeOne'>
                                         </div>
                                         <div class='col-6 borderLeft'>
                                             <input type="text" class="form-control" name='toAOne'>
                                         </div>
                                     </div>
                                     <!-- end row -->

                                 </td>
                             </tr>

                             <tr>
                                 <td style='text-align:left' class='pl-1'>
                                     <input type="text" class="form-control " name='nameTwo'>
                                 </td>
                                 <td> <input type="text" class="form-control " name='countryTwo'></td>
                                 <td>
                                     <div class='row'>
                                         <div class='col-6 text-center'>
                                             <input type="text" class="form-control" name='fromDeTwo'>
                                         </div>
                                         <div class='col-6 borderLeft'>
                                             <input type="text" class="form-control" name='toATwo'>
                                         </div>
                                     </div>
                                     <!-- end row -->

                                 </td>
                             </tr>

                             <tr>
                                 <td style='text-align:left' class='pl-1'>
                                     <input type="text" class="form-control " name='nameThree'>
                                 </td>
                                 <td> <input type="text" class="form-control " name='countryThree'></td>
                                 <td>
                                     <div class='row'>
                                         <div class='col-6 text-center'>
                                             <input type="text" class="form-control" name='fromDeThree'>
                                         </div>
                                         <div class='col-6 borderLeft'>
                                             <input type="text" class="form-control" name='toAThree'>
                                         </div>
                                     </div>
                                     <!-- end row -->

                                 </td>
                             </tr>

                             <tr>
                                 <td style='text-align:left' class='pl-1'>
                                     <input type="text" class="form-control " name='nameFour'>
                                 </td>
                                 <td> <input type="text" class="form-control " name='countryFour'></td>
                                 <td>
                                     <div class='row'>
                                         <div class='col-6 text-center'>
                                             <input type="text" class="form-control" name='fromDeFour'>
                                         </div>
                                         <div class='col-6 borderLeft'>
                                             <input type="text" class="form-control" name='toAFour'>
                                         </div>
                                     </div>
                                     <!-- end row -->

                                 </td>
                             </tr>


                             <tr>
                                 <td style='text-align:left' class='pl-1'>
                                     <input type="text" class="form-control " name='nameFive'>
                                 </td>
                                 <td> <input type="text" class="form-control " name='countryFive'></td>
                                 <td>
                                     <div class='row'>
                                         <div class='col-6 text-center'>
                                             <input type="text" class="form-control" name='fromDeFive'>
                                         </div>
                                         <div class='col-6 borderLeft'>
                                             <input type="text" class="form-control" name='toAFive'>
                                         </div>
                                     </div>
                                     <!-- end row -->

                                 </td>
                             </tr>


                         </tbody>
                     </table>

                 </div>

                 <div class='row'>
                     <div class='col-7'>
                         <label>
                             <span class='no_box'> 22</span>
                         </label>
                     </div>

                     <div class='col-12'>
                         <h6 class='text-center'>
                             I declare that I have answered all required questions in this application fully and truthfully<br />
                             Je déclare avoir donné des réponses exactes et complètes à toutes les questions de la présente demande
                         </h6>
                     </div>
                 </div>

                 <div class='container'>
                     <div class='row mt-4'>
                         <div class='col-6'>
                             <div class='borderBottom mb-1'>
                                 <input type="file" name='file' class="form-control" placeholder="">
                             </div>

                             <p class='text-center'>Signature of applicant - Signature du requérant Date </p>
                         </div>

                         <div class='col-6'>
                             <div class='borderBottom mb-1'>
                                 <input type="text" class="form-control" placeholder="D-J M Y-A" name='docDate'>
                             </div>

                             <p class='text-center'>Date </p>
                         </div>
                     </div>

                 </div>


             </div>

             <div class='mb-3'>
                 <button type="submit" name='submit' class="btn btn-dark col-4 d-block m-auto ">Submit</button>
             </div>


         </form>

         <?php

            // using extract because on the form, it has an action 
            // echo htmlspecialchars($_SERVER["PHP_SELF"]);
            extract($_POST);
            // first thing we need to extract the post since we are not using the post or the get method vocally 


            // check if the submit button is clicked or not 
            if (isset($_POST['submit'])) {

                // we have to extract the files
                $files = $_FILES['file'];

                $fileName = $files['name'];
                $fileTmpName = $files['tmp_name'];
                $fileSize = $files['size'];
                $fileError = $files['error'];
                $fileType = $files['type'];
                $ra = rand(1000, 1000);

                //now we will code the type of file we want to allow to be uploaded 

                $fileExt = explode('.', $fileName);
                $fileActualExt = strtolower(end($fileExt)); //the end get the last peice of data in an array 

                //creating an array of the information we want to allow 
                $allowed = array('jpg', 'jpeg', 'png', 'pdf');

                if (in_array($fileActualExt, $allowed)) {
                    if ($fileError === 0) {
                        if ($fileSize < 50000000) {
                            // main upload file code 
                            // we have to rename it so that it will not have same name for different images
                            $fileNameNew =  $ra . "." . $fileActualExt;
                            $fileDestination = 'uploads/' . $fileNameNew;
                            //main upload code
                            move_uploaded_file($fileTmpName, $fileDestination);
                        }
                    }
                }

                $file = $ra . '.' . $fileActualExt;



                // associative array to accept the variables and pass them to the database
                $array = array(
                    'SelectedEng' => $SelectedEng,
                    'file_reference' => $file_reference,
                    'surname' => $surname,
                    'firstName' => $firstName,
                    'middleName' => $middleName,
                    'mailingAddress' => $mailingAddress,
                    'telephoneNumber' => $telephoneNumber,
                    'faxNumber' => $faxNumber,
                    'residentialAddress' => $residentialAddress,
                    'dateOfBirth' => $dateOfBirth,
                    'placeOfBirth' => $placeOfBirth,
                    'provState' => $provState,
                    'countryPays' => $countryPays,
                    'citizen' => $citizen,
                    'sex' => $sex,
                    'martialStatus' => $martialStatus,
                    'familyNameApplicant' => $familyNameApplicant,
                    'familyNameSpouse' => $familyNameSpouse,
                    'familyNamePartner' => $familyNamePartner,
                    'familyNameChildren' => $familyNameChildren
                );


                $array2 = array(
                    'firstSecondNameApplicant' => $firstSecondNameApplicant,
                    'firstSecondNameSpouse' => $firstSecondNameSpouse,
                    'firstSecondNamePartner' => $firstSecondNamePartner,
                    'firstSecondNameChildren' => $firstSecondNameChildren,
                    'relationshipApplicant' => $relationshipApplicant,
                    'relationshipSpouse' => $relationshipSpouse,
                    'relationshipPartner' => $relationshipPartner,
                    'relationshipChildren' => $relationshipChildren,
                    'dobApplicant' => $dobApplicant,
                    'dobSpouse' => $dobSpouse,
                    'dobPartner' => $dobPartner,
                    'dobChildren' => $dobChildren,
                    'placeOfBirthApplicant' => $placeOfBirthApplicant,
                    'placeOfBirthSpouse' => $placeOfBirthSpouse,
                    'placeOfBirthPartner' => $placeOfBirthPartner,
                    'placeOfBirthChildren' => $placeOfBirthChildren,
                    'citizenshipApplicant' => $citizenshipApplicant,
                    'citizenshipSpouse' => $citizenshipSpouse,
                    'citizenshipPartner' => $citizenshipPartner,
                    'citizenshipChildren' => $citizenshipChildren

                );

                $array3 = array(
                    'passportNoApplicant' => $passportNoApplicant,
                    'passportNoSpouse' => $passportNoSpouse,
                    'passportNoPartner' => $passportNoPartner,
                    'passportNoChildren' => $passportNoChildren,
                    'passportExpiryDateApplicant' => $passportExpiryDateApplicant,
                    'passportExpiryDateSpouse' => $passportExpiryDateSpouse,
                    'passportExpiryDatePartner' => $passportExpiryDatePartner,
                    'passportExpiryDateChildren' => $passportExpiryDateChildren,
                    'martialStatusApplicant' => $martialStatusApplicant,
                    'martialStatusSpouse' => $martialStatusSpouse,
                    'martialStatusPartner' => $martialStatusPartner,
                    'martialStatusChildren' => $martialStatusChildren,
                    'accompanySpouse' => $accompanySpouse,
                    'accompanyPartner' => $accompanyPartner,
                    'accompanyChildren' => $accompanyChildren,
                    'officerAgent' => $officerAgent,
                    'presentJob' => $presentJob,
                    'heldJobMonths' => $heldJobMonths,
                    'heldJobYears' => $heldJobYears,
                    'nameAddressEmployer' => $nameAddressEmployer,
                    'nameAddressEmployerCanada' => $nameAddressEmployerCanada,
                    'myOccupationInCanada' => $myOccupationInCanada,
                    'mySalary' => $mySalary,
                    'iAmExpected' => $iAmExpected,
                    'myEmployment' => $myEmployment


                );
                $array4 = array(
                    'beenTreated' => $beenTreated,
                    'beenArrested' => $beenArrested,
                    'refuseAdmission' => $refuseAdmission,
                    'appliedFor' => $appliedFor,
                    'beenRefusedAVisa' => $beenRefusedAVisa,
                    'inPeriods' => $inPeriods,
                    'duringThe' => $duringThe,
                    'nameOne' => $nameOne,
                    'countryOne' => $countryOne,
                    'fromDeOne' => $fromDeOne,
                    'toAOne' => $toAOne,
                    'nameTwo' => $nameTwo,
                    'countryTwo' => $countryTwo,
                    'fromDeTwo' => $fromDeTwo,
                    'toATwo' => $toATwo,
                    'nameThree' => $nameThree,
                    'countryThree' => $countryThree,
                    'countryThree' => $countryThree,
                    'fromDeThree' => $fromDeThree,
                    'toAThree' => $toAThree,
                    'nameFour' => $nameFour,
                    'countryFour' => $countryFour,
                    'fromDeFour' => $fromDeFour,
                    'toAFour' => $toAFour,
                    'nameFive' => $nameFive,
                    'countryFive' => $countryFive,
                    'fromDeFive' => $fromDeFive,
                    'toAFive' => $toAFive,
                    'file' => $file,
                    'docDate' => $docDate,
                    'date_created' => $today



                );

                // this function is where all the magics happens
                function insertInto($tableName, $array, $successMsg)
                {
                    // declaring the connection to be global so i can use it within the function
                    global $db_conx;
                    // global $str_keys;

                    // making sure these variables are empty
                    $str_keys = "";
                    $str_value = "";

                    // getting all the variables to point out
                    // constructing the sql insert syntax 
                    foreach ($array as $key => $values) {
                        $str_keys .=  ' ' . $key . ',';
                        $str_value .= "'" . ($values) . "',";
                    }

                    // remove the , from the last value and key so we don`t get an sql error
                    $str_keys =  rtrim($str_keys, ',');
                    $str_value = rtrim($str_value, ',');




                    // sql insert statement with the various array values
                    $sql = "INSERT INTO $tableName ($str_keys) VALUE ({$str_value}) ";
                    $query = $db_conx->query($sql);
                    if ($query) {
                        echo $successMsg;
                    } else {
                        // echo 'Failed';
                        echo var_dump($db_conx->error);
                    }
                }

                $tableName = 'work_permit';
                $successMsg = 'success, Your record has been submitted and its carefully observed!';
                insertInto($tableName, $array, $successMsg);

                // insert for workpermit 2
                $tableName = 'work_permit_2';
                insertInto($tableName, $array2, $successMsg2);

                // insert for workpermit 3
                $tableName = 'work_permit_3';
                insertInto($tableName, $array3, $successMsg3);

                // insert for workpermit 4
                $tableName = 'work_permit_4';
                insertInto($tableName, $array4, $successMsg4);
            }


            ?>


     </section>







     <!-- Optional JavaScript -->
     <!-- jQuery first, then Popper.js, then Bootstrap JS -->
     <script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
     <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
     <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.4.1/dist/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
     <script src="js/move.js" crossorigin="anonymous"></script>

 </body>

 </html>
 <?php
    ob_end_flush(); ?>