Advertisement
Guest User

surveyee_info.php

a guest
Jun 27th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 17.16 KB | None | 0 0
  1. <?php
  2.  
  3. include_once 'connect_db.php';
  4. session_start ();
  5.  
  6. /*if ($_SESSION['userEmail']==""){
  7.     header ('location:index.php');
  8. }*/
  9.  
  10.  
  11. include_once 'header.php';
  12.  
  13. // insert data   not yet done
  14. if (isset($_POST['btnSave'])){
  15.     $district= $_POST['district'];
  16.     $upazila= $_POST['upazila'];
  17.     $union= $_POST['txtUnion'];
  18.     $ward= $_POST['txtWard'];
  19.     $village= $_POST['txtVillage'];
  20.     $surveyor= $_POST['txtSelect_surveyor'];
  21.     $family_head= $_POST['txtFamilyHead'];
  22.     $father= $_POST['txtFather'];
  23.     $mother= $_POST['txtMother'];
  24.     $gender= $_POST['txtSelect_gender'];
  25.     $spouse= $_POST['txtSpouse'];
  26.     $nid= $_POST['txtNid'];
  27.     $profession= $_POST['txtProfession'];
  28.     $spouse_prof= $_POST['txtSpouseProfession'];
  29.     $income= $_POST['txtIncome'];
  30.     $house_cond= $_POST['txtHouseCondition'];
  31.     $home_farm= $_POST['txtHomeFarming'];
  32.     $sanitation= $_POST['txtSanitation'];
  33.     $water= $_POST['txtWater'];
  34.  
  35.     $insert=$pdo->prepare ("insert into tbl_surveyee(district,upazila,union_name,ward,village,surveyor,family_head,sur_father,sur_mother,
  36. gender,sur_spouse,nid,own_prof,spouse_prof,yearly_income,house_cond,home_farm,sanitation,water_source)
  37. values(:district,:upazila,:unionName,:ward,:village,:surveyor,:family_head,:father,:mother,:gender,:spouse,:nid,:profession,:spouse_prof,:income,:house_cond,:home_farm,:sanitation,:water)");
  38.  
  39.     $insert->bindParam (':district',$district);
  40.     $insert->bindParam(':upazila',$upazila);
  41.     $insert->bindParam(':unionName',$union);
  42.     $insert->bindParam(':ward',$ward);
  43.     $insert->bindParam (':village',$village);
  44.     $insert->bindParam(':surveyor',$surveyor);
  45.     $insert->bindParam(':family_head',$family_head);
  46.     $insert->bindParam(':father',$father);
  47.     $insert->bindParam (':mother',$mother);
  48.     $insert->bindParam(':gender',$gender);
  49.     $insert->bindParam(':spouse',$spouse);
  50.     $insert->bindParam(':nid',$nid);
  51.     $insert->bindParam(':profession',$profession);
  52.     $insert->bindParam (':spouse_prof',$spouse_prof);
  53.     $insert->bindParam(':income',$income);
  54.     $insert->bindParam(':house_cond',$house_cond);
  55.     $insert->bindParam(':home_farm',$home_farm);
  56.     $insert->bindParam(':sanitation',$sanitation);
  57.     $insert->bindParam (':water',$water);
  58.  
  59.  
  60.     if($insert->execute ()){
  61.         echo 'Insert Successful';
  62.     }
  63.     else{
  64.         echo 'Insert Fail';
  65.     }
  66. }
  67.  
  68.  
  69. ?>
  70.  
  71.  
  72. <!-- Content Wrapper. Contains page content -->
  73. <div class="content-wrapper">
  74.     <!-- Content Header (Page header) -->
  75.     <section class="content-header">
  76.         <h1>
  77.             Surveyee Information
  78.             <small></small>
  79.         </h1>
  80.         <ol class="breadcrumb">
  81.             <li><a href="#"><i class="fa fa-dashboard"></i> Level</a></li>
  82.             <li class="active">Here</li>
  83.         </ol>
  84.     </section>
  85.  
  86.     <!-- Main content -->
  87.     <section class="content container-fluid">
  88.  
  89.         <!--------------------------
  90.           | Your Page Content Here |
  91.           -------------------------->
  92.         <div class="box box-primary">
  93.             <div class="box-header with-border">
  94.                 <h3 class="box-title">Survey Area</h3>
  95.             </div>
  96.             <!-- /.box-header -->
  97.             <!-- form start -->
  98.             <form role="form" action="" method="post">
  99.                 <div class="box-body">
  100.                     <div class="col-md-4">
  101.                         <div class="form-group">
  102.                             <label>District</label>
  103. <!--                            <select class="form-control" name="txtSelect_district">-->
  104.                             <input class="form-control" list="district" name="district" placeholder="District Name">
  105.                             <datalist id="district">
  106.                                 <option value="" disabled selected >Select District</option>
  107.                                 <?php
  108.                                 $select=$pdo->prepare ("select dist_name from tbl_district order by dist_id desc");
  109.                                 $select->execute ();
  110.                                 while ($row=$select->fetch (PDO::FETCH_OBJ)){
  111.                                     echo '
  112.        <option>'.$row->dist_name.'</option>
  113. ';
  114.                                 }
  115.                                 ?>
  116.                                 </datalist>
  117. <!--                            </select>-->
  118.                         </div>
  119.                         <div class="form-group">
  120.                             <label>Upa zila</label>
  121. <!--                            <select class="form-control" name="txtSelect_upazila">-->
  122.                             <input class="form-control" list="upazila" name="upazila" placeholder="Upazila Name">
  123.                             <datalist id="upazila">
  124.                                 <option value="" disabled selected >Select Upazila</option>
  125.                                 <?php
  126.                                 $select=$pdo->prepare ("select upazila_name from tbl_upazila_f order by upazila_id desc");
  127.                                 $select->execute ();
  128.                                 while ($row=$select->fetch (PDO::FETCH_OBJ)){
  129.                                     echo '
  130.        <option>'.$row->upazila_name.'</option>
  131. ';
  132.                                 }
  133.                                 ?>
  134.                             </datalist>
  135. <!--                            </select>-->
  136.                         </div>
  137.                        <!-- <div class="form-group">
  138.                             <label for="exampleInputEmail1">Upa Zila</label>
  139.                             <input type="text" class="form-control" id="surveyorName" placeholder="Surveyor Name">
  140.                         </div>-->
  141.                     </div>
  142.                     <div class="col-md-4">
  143.                         <div class="form-group">
  144.                             <label for="exampleInputEmail1">Union</label>
  145.                             <input type="text" class="form-control" id="surveyorName" name="txtUnion" placeholder="Union">
  146.                         </div>
  147.                         <div class="form-group">
  148.                             <label for="exampleInputEmail1">Ward</label>
  149.                             <input type="text" class="form-control" id="surveyorName" name="txtWard" placeholder="Ward">
  150.                         </div>
  151.  
  152.                     </div>
  153.                     <div class="col-md-4">
  154.                         <div class="form-group">
  155.                             <label for="exampleInputEmail1">Village</label>
  156.                             <input type="text" class="form-control" id="surveyorName" name="txtVillage" placeholder="Village">
  157.                         </div>
  158.                         <div class="form-group">
  159.                             <label>Surveyor</label>
  160.                             <select class="form-control" name="txtSelect_surveyor">
  161.                                 <option value="" disabled selected >Select Surveyor</option>
  162.                                 <?php
  163.                                 $select=$pdo->prepare ("select surveyorName from tbl_surveyor order by id desc");
  164.                                 $select->execute ();
  165.                                 while ($row=$select->fetch (PDO::FETCH_OBJ)){
  166.                                     echo '
  167.        <option>'.$row->surveyorName.'</option>
  168. ';
  169.                                 }
  170.                                 ?>
  171.                             </select>
  172.                         </div>
  173.                     </div>
  174.                 </div>
  175.                 <!-- /.box-body -->
  176.                 <div class="box-header with-border">
  177.                     <h3 class="box-title">Family Information</h3>
  178.                 </div>
  179. <!--  family info-->
  180.                 <div class="box-body">
  181.                     <div class="col-md-6">
  182.                         <div class="form-group">
  183.                             <label for="exampleInputEmail1">Name of Family Head</label>
  184.                             <input type="text" class="form-control" id="surveyorName" name="txtFamilyHead" placeholder="Name of Family Head">
  185.                         </div>
  186.                         <div class="form-group">
  187.                             <label for="exampleInputEmail1">Father's Name</label>
  188.                             <input type="text" class="form-control" id="surveyorName" name="txtFather" placeholder="Father's Name">
  189.                         </div>
  190.                         <div class="form-group">
  191.                             <label for="exampleInputEmail1">Mother's Name</label>
  192.                             <input type="text" class="form-control" id="surveyorName" name="txtMother" placeholder="Mother's Name">
  193.                         </div>
  194.                         <div class="form-group">
  195.                             <label>Gender</label>
  196.                             <select class="form-control" name="txtSelect_gender">
  197.                                 <option value="" disabled selected >Select Gender</option>
  198.                                 <option>Male</option>
  199.                                 <option>Female</option>
  200.                             </select>
  201.                         </div>
  202.                     </div>
  203.                     <div class="col-md-6">
  204.                         <div class="form-group">
  205.                             <label for="exampleInputEmail1">Spouse Name</label>
  206.                             <input type="text" class="form-control" id="surveyorName" name="txtSpouse" placeholder="Spouse Name">
  207.                         </div>
  208.                         <div class="form-group">
  209.                             <label for="exampleInputEmail1">NID No.</label>
  210.                             <input type="text" class="form-control" id="surveyorName" name="txtNid" placeholder="NID No.">
  211.                         </div>
  212.                         <div class="form-group">
  213.                             <label for="exampleInputEmail1">Own Profession</label>
  214.                             <input type="text" class="form-control" id="surveyorName" name="txtProfession" placeholder="Own Profession">
  215.                         </div>
  216.                         <div class="form-group">
  217.                             <label for="exampleInputEmail1">Spouse Profession</label>
  218.                             <input type="text" class="form-control" id="surveyorName" name="txtSpouseProfession" placeholder="Spouse Profession">
  219.                         </div>
  220.                     </div>
  221.                 </div>
  222. <!--   /. family info-->
  223.                 <div class="box-header with-border">
  224.                     <h3 class="box-title">Family Condition</h3>
  225.                 </div>
  226.                 <div class="box-body">
  227.                     <div class="col-md-6">
  228.                         <div class="form-group">
  229.                             <label for="exampleInputEmail1">Yearly Income</label>
  230.                             <input type="text" class="form-control" id="surveyorName" name="txtIncome" placeholder="Surveyor Name">
  231.                         </div>
  232.                         <div class="form-group">
  233.                             <label for="exampleInputEmail1">Condition of House</label>
  234.                             <input type="text" class="form-control" id="surveyorName" name="txtHouseCondition" placeholder="Surveyor Name">
  235.                         </div>
  236.                         <div class="form-group">
  237.                             <label for="exampleInputEmail1">Visible Home Farming</label>
  238.                             <input type="text" class="form-control" id="surveyorName" name="txtHomeFarming" placeholder="Surveyor Name">
  239.                         </div>
  240.                     </div>
  241.                     <div class="col-md-6">
  242.                         <div class="form-group">
  243.                             <label for="exampleInputEmail1">Sanitation</label>
  244.                             <input type="text" class="form-control" id="surveyorName" name="txtSanitation" placeholder="Surveyor Name">
  245.                         </div>
  246.                         <div class="form-group">
  247.                             <label for="exampleInputEmail1">Drinking Water Source</label>
  248.                             <input type="text" class="form-control" id="surveyorName" name="txtWater" placeholder="Surveyor Name">
  249.                         </div>
  250.                     </div>
  251.                     <div class="col-md-12">
  252.                     </div>
  253.                 </div>
  254.                 <div class="box-footer">
  255.                     <button type="submit" class="btn btn-primary" name="btnSave">Save</button>
  256.                 </div>
  257.  
  258. <!--                Display data in a table-->
  259.                 <div class="box-body">
  260.                 <div class="col-md-12" style="overflow-x:auto;">
  261.                     <table id="tblSurveyor" class="table table-hover">
  262.                         <thead>
  263.                         <tr>
  264.                             <th>Family ID</th>
  265.                             <th>District</th>
  266.                             <th>Upazila</th>
  267.                             <th>Union</th>
  268.                             <th>Ward</th>
  269.                             <th>Village</th>
  270.                             <th>Surveyor</th>
  271.                             <th>Family Head</th>
  272.                             <th>Father's Name</th>
  273.                             <th>Mother's Name</th>
  274.                             <th>Gender</th>
  275.                             <th>Spouse Name</th>
  276.                             <th>NID No</th>
  277.                             <th>Profession</th>
  278.                             <th>Spouse Profession</th>
  279.                             <th>Yearly Income</th>
  280.                             <th>House Condition</th>
  281.                             <th>Home Farming</th>
  282.                             <th>Sanitation</th>
  283.                             <th>Water Source</th>
  284.                             <th colspan="3" style="text-align: center">Action</th>
  285.                         </tr>
  286.                         </thead>
  287.                         <tbody>
  288.                         <?php
  289.                         $select=$pdo->prepare ("select * from tbl_surveyee order by surveyee_id desc");
  290.                         $select->execute ();
  291.                         while ($row=$select->fetch (PDO::FETCH_OBJ)){
  292.                             echo '
  293.                    <tr>
  294.                        <td>'.$row->surveyee_id.'</td>
  295.                        <td>'.$row->district.'</td>
  296.                        <td>'.$row->upazila.'</td>
  297.                        <td>'.$row->union_name.'</td>
  298.                        <td>'.$row->ward.'</td>
  299.                         <td>'.$row->village.'</td>
  300.                        <td>'.$row->surveyor.'</td>
  301.                        <td>'.$row->family_head.'</td>
  302.                        <td>'.$row->sur_father.'</td>
  303.                        <td>'.$row->sur_mother.'</td>
  304.                         <td>'.$row->gender.'</td>
  305.                        <td>'.$row->sur_spouse.'</td>
  306.                        <td>'.$row->nid.'</td>
  307.                        <td>'.$row->own_prof.'</td>
  308.                        <td>'.$row->spouse_prof.'</td>
  309.                         <td>'.$row->yearly_income.'</td>
  310.                        <td>'.$row->house_cond.'</td>
  311.                        <td>'.$row->home_farm.'</td>
  312.                        <td>'.$row->sanitation.'</td>
  313.                        <td>'.$row->water_source.'</td>
  314.                        <td style="width: 10px">
  315.             <button type="submit" value="'.$row->surveyee_id.'" class="btn btn-danger" name="btnDelete"><span class="glyphicon glyphicon-trash"></span></button>          
  316.                        </td>
  317.                        <td style="width: 10px">
  318.           <button type="submit" value="'.$row->surveyee_id.'" class="btn btn-warning"  name="btnEdit"><span class="glyphicon glyphicon-edit"></span></button>              
  319.                        </td>
  320.                        <td style="width: 10px">
  321.           <button type="submit"  class="btn btn-success"  name="btnInsert" id="insertbtn" onclick="redirect()"><span class="glyphicon glyphicon-plus"></span></button>              
  322.                        </td>
  323.                    </tr>
  324.            ';
  325.                         }
  326.                         ?>
  327.                         </tbody>
  328.                     </table>
  329.                 </div>
  330.                 </div>
  331.     <!--   /. Display data in a table-->
  332.             </form>
  333.         </div>
  334.  
  335.     </section>
  336.     <!-- /.content -->
  337. </div>
  338. <!-- /.content-wrapper -->
  339. <script type="text/javascript">
  340.     function redirect() {
  341.         let url = window.location.origin;
  342.         window.location.replace(url+'/children_info.php');
  343.         // location.replace("https://www.w3schools.com")
  344.     }
  345. </script>
  346. <!--<script>
  347.     $(document).ready(function(){
  348.         $("#insertbtn").click(function(){
  349.              // alert('#insert23');
  350.               var children_page = "http://localhost/survey/children_info.php";
  351.               document.location.href = "children_page";
  352.         });
  353.     });
  354. </script>-->
  355.  
  356. <!--<script type="text/javascript">
  357.     $(document).ready(function () {
  358.         $("#insertbtn").click(function () {
  359.             $(location).attr('href','http://localhost/survey/children_info.php')
  360.         })
  361.     });
  362. </script>-->
  363.  
  364. <?php
  365. include_once 'footer.php';
  366. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement