Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include_once 'connect_db.php';
- session_start ();
- /*if ($_SESSION['userEmail']==""){
- header ('location:index.php');
- }*/
- include_once 'header.php';
- // insert data not yet done
- if (isset($_POST['btnSave'])){
- $district= $_POST['district'];
- $upazila= $_POST['upazila'];
- $union= $_POST['txtUnion'];
- $ward= $_POST['txtWard'];
- $village= $_POST['txtVillage'];
- $surveyor= $_POST['txtSelect_surveyor'];
- $family_head= $_POST['txtFamilyHead'];
- $father= $_POST['txtFather'];
- $mother= $_POST['txtMother'];
- $gender= $_POST['txtSelect_gender'];
- $spouse= $_POST['txtSpouse'];
- $nid= $_POST['txtNid'];
- $profession= $_POST['txtProfession'];
- $spouse_prof= $_POST['txtSpouseProfession'];
- $income= $_POST['txtIncome'];
- $house_cond= $_POST['txtHouseCondition'];
- $home_farm= $_POST['txtHomeFarming'];
- $sanitation= $_POST['txtSanitation'];
- $water= $_POST['txtWater'];
- $insert=$pdo->prepare ("insert into tbl_surveyee(district,upazila,union_name,ward,village,surveyor,family_head,sur_father,sur_mother,
- gender,sur_spouse,nid,own_prof,spouse_prof,yearly_income,house_cond,home_farm,sanitation,water_source)
- values(:district,:upazila,:unionName,:ward,:village,:surveyor,:family_head,:father,:mother,:gender,:spouse,:nid,:profession,:spouse_prof,:income,:house_cond,:home_farm,:sanitation,:water)");
- $insert->bindParam (':district',$district);
- $insert->bindParam(':upazila',$upazila);
- $insert->bindParam(':unionName',$union);
- $insert->bindParam(':ward',$ward);
- $insert->bindParam (':village',$village);
- $insert->bindParam(':surveyor',$surveyor);
- $insert->bindParam(':family_head',$family_head);
- $insert->bindParam(':father',$father);
- $insert->bindParam (':mother',$mother);
- $insert->bindParam(':gender',$gender);
- $insert->bindParam(':spouse',$spouse);
- $insert->bindParam(':nid',$nid);
- $insert->bindParam(':profession',$profession);
- $insert->bindParam (':spouse_prof',$spouse_prof);
- $insert->bindParam(':income',$income);
- $insert->bindParam(':house_cond',$house_cond);
- $insert->bindParam(':home_farm',$home_farm);
- $insert->bindParam(':sanitation',$sanitation);
- $insert->bindParam (':water',$water);
- if($insert->execute ()){
- echo 'Insert Successful';
- }
- else{
- echo 'Insert Fail';
- }
- }
- ?>
- <!-- Content Wrapper. Contains page content -->
- <div class="content-wrapper">
- <!-- Content Header (Page header) -->
- <section class="content-header">
- <h1>
- Surveyee Information
- <small></small>
- </h1>
- <ol class="breadcrumb">
- <li><a href="#"><i class="fa fa-dashboard"></i> Level</a></li>
- <li class="active">Here</li>
- </ol>
- </section>
- <!-- Main content -->
- <section class="content container-fluid">
- <!--------------------------
- | Your Page Content Here |
- -------------------------->
- <div class="box box-primary">
- <div class="box-header with-border">
- <h3 class="box-title">Survey Area</h3>
- </div>
- <!-- /.box-header -->
- <!-- form start -->
- <form role="form" action="" method="post">
- <div class="box-body">
- <div class="col-md-4">
- <div class="form-group">
- <label>District</label>
- <!-- <select class="form-control" name="txtSelect_district">-->
- <input class="form-control" list="district" name="district" placeholder="District Name">
- <datalist id="district">
- <option value="" disabled selected >Select District</option>
- <?php
- $select=$pdo->prepare ("select dist_name from tbl_district order by dist_id desc");
- $select->execute ();
- while ($row=$select->fetch (PDO::FETCH_OBJ)){
- echo '
- <option>'.$row->dist_name.'</option>
- ';
- }
- ?>
- </datalist>
- <!-- </select>-->
- </div>
- <div class="form-group">
- <label>Upa zila</label>
- <!-- <select class="form-control" name="txtSelect_upazila">-->
- <input class="form-control" list="upazila" name="upazila" placeholder="Upazila Name">
- <datalist id="upazila">
- <option value="" disabled selected >Select Upazila</option>
- <?php
- $select=$pdo->prepare ("select upazila_name from tbl_upazila_f order by upazila_id desc");
- $select->execute ();
- while ($row=$select->fetch (PDO::FETCH_OBJ)){
- echo '
- <option>'.$row->upazila_name.'</option>
- ';
- }
- ?>
- </datalist>
- <!-- </select>-->
- </div>
- <!-- <div class="form-group">
- <label for="exampleInputEmail1">Upa Zila</label>
- <input type="text" class="form-control" id="surveyorName" placeholder="Surveyor Name">
- </div>-->
- </div>
- <div class="col-md-4">
- <div class="form-group">
- <label for="exampleInputEmail1">Union</label>
- <input type="text" class="form-control" id="surveyorName" name="txtUnion" placeholder="Union">
- </div>
- <div class="form-group">
- <label for="exampleInputEmail1">Ward</label>
- <input type="text" class="form-control" id="surveyorName" name="txtWard" placeholder="Ward">
- </div>
- </div>
- <div class="col-md-4">
- <div class="form-group">
- <label for="exampleInputEmail1">Village</label>
- <input type="text" class="form-control" id="surveyorName" name="txtVillage" placeholder="Village">
- </div>
- <div class="form-group">
- <label>Surveyor</label>
- <select class="form-control" name="txtSelect_surveyor">
- <option value="" disabled selected >Select Surveyor</option>
- <?php
- $select=$pdo->prepare ("select surveyorName from tbl_surveyor order by id desc");
- $select->execute ();
- while ($row=$select->fetch (PDO::FETCH_OBJ)){
- echo '
- <option>'.$row->surveyorName.'</option>
- ';
- }
- ?>
- </select>
- </div>
- </div>
- </div>
- <!-- /.box-body -->
- <div class="box-header with-border">
- <h3 class="box-title">Family Information</h3>
- </div>
- <!-- family info-->
- <div class="box-body">
- <div class="col-md-6">
- <div class="form-group">
- <label for="exampleInputEmail1">Name of Family Head</label>
- <input type="text" class="form-control" id="surveyorName" name="txtFamilyHead" placeholder="Name of Family Head">
- </div>
- <div class="form-group">
- <label for="exampleInputEmail1">Father's Name</label>
- <input type="text" class="form-control" id="surveyorName" name="txtFather" placeholder="Father's Name">
- </div>
- <div class="form-group">
- <label for="exampleInputEmail1">Mother's Name</label>
- <input type="text" class="form-control" id="surveyorName" name="txtMother" placeholder="Mother's Name">
- </div>
- <div class="form-group">
- <label>Gender</label>
- <select class="form-control" name="txtSelect_gender">
- <option value="" disabled selected >Select Gender</option>
- <option>Male</option>
- <option>Female</option>
- </select>
- </div>
- </div>
- <div class="col-md-6">
- <div class="form-group">
- <label for="exampleInputEmail1">Spouse Name</label>
- <input type="text" class="form-control" id="surveyorName" name="txtSpouse" placeholder="Spouse Name">
- </div>
- <div class="form-group">
- <label for="exampleInputEmail1">NID No.</label>
- <input type="text" class="form-control" id="surveyorName" name="txtNid" placeholder="NID No.">
- </div>
- <div class="form-group">
- <label for="exampleInputEmail1">Own Profession</label>
- <input type="text" class="form-control" id="surveyorName" name="txtProfession" placeholder="Own Profession">
- </div>
- <div class="form-group">
- <label for="exampleInputEmail1">Spouse Profession</label>
- <input type="text" class="form-control" id="surveyorName" name="txtSpouseProfession" placeholder="Spouse Profession">
- </div>
- </div>
- </div>
- <!-- /. family info-->
- <div class="box-header with-border">
- <h3 class="box-title">Family Condition</h3>
- </div>
- <div class="box-body">
- <div class="col-md-6">
- <div class="form-group">
- <label for="exampleInputEmail1">Yearly Income</label>
- <input type="text" class="form-control" id="surveyorName" name="txtIncome" placeholder="Surveyor Name">
- </div>
- <div class="form-group">
- <label for="exampleInputEmail1">Condition of House</label>
- <input type="text" class="form-control" id="surveyorName" name="txtHouseCondition" placeholder="Surveyor Name">
- </div>
- <div class="form-group">
- <label for="exampleInputEmail1">Visible Home Farming</label>
- <input type="text" class="form-control" id="surveyorName" name="txtHomeFarming" placeholder="Surveyor Name">
- </div>
- </div>
- <div class="col-md-6">
- <div class="form-group">
- <label for="exampleInputEmail1">Sanitation</label>
- <input type="text" class="form-control" id="surveyorName" name="txtSanitation" placeholder="Surveyor Name">
- </div>
- <div class="form-group">
- <label for="exampleInputEmail1">Drinking Water Source</label>
- <input type="text" class="form-control" id="surveyorName" name="txtWater" placeholder="Surveyor Name">
- </div>
- </div>
- <div class="col-md-12">
- </div>
- </div>
- <div class="box-footer">
- <button type="submit" class="btn btn-primary" name="btnSave">Save</button>
- </div>
- <!-- Display data in a table-->
- <div class="box-body">
- <div class="col-md-12" style="overflow-x:auto;">
- <table id="tblSurveyor" class="table table-hover">
- <thead>
- <tr>
- <th>Family ID</th>
- <th>District</th>
- <th>Upazila</th>
- <th>Union</th>
- <th>Ward</th>
- <th>Village</th>
- <th>Surveyor</th>
- <th>Family Head</th>
- <th>Father's Name</th>
- <th>Mother's Name</th>
- <th>Gender</th>
- <th>Spouse Name</th>
- <th>NID No</th>
- <th>Profession</th>
- <th>Spouse Profession</th>
- <th>Yearly Income</th>
- <th>House Condition</th>
- <th>Home Farming</th>
- <th>Sanitation</th>
- <th>Water Source</th>
- <th colspan="3" style="text-align: center">Action</th>
- </tr>
- </thead>
- <tbody>
- <?php
- $select=$pdo->prepare ("select * from tbl_surveyee order by surveyee_id desc");
- $select->execute ();
- while ($row=$select->fetch (PDO::FETCH_OBJ)){
- echo '
- <tr>
- <td>'.$row->surveyee_id.'</td>
- <td>'.$row->district.'</td>
- <td>'.$row->upazila.'</td>
- <td>'.$row->union_name.'</td>
- <td>'.$row->ward.'</td>
- <td>'.$row->village.'</td>
- <td>'.$row->surveyor.'</td>
- <td>'.$row->family_head.'</td>
- <td>'.$row->sur_father.'</td>
- <td>'.$row->sur_mother.'</td>
- <td>'.$row->gender.'</td>
- <td>'.$row->sur_spouse.'</td>
- <td>'.$row->nid.'</td>
- <td>'.$row->own_prof.'</td>
- <td>'.$row->spouse_prof.'</td>
- <td>'.$row->yearly_income.'</td>
- <td>'.$row->house_cond.'</td>
- <td>'.$row->home_farm.'</td>
- <td>'.$row->sanitation.'</td>
- <td>'.$row->water_source.'</td>
- <td style="width: 10px">
- <button type="submit" value="'.$row->surveyee_id.'" class="btn btn-danger" name="btnDelete"><span class="glyphicon glyphicon-trash"></span></button>
- </td>
- <td style="width: 10px">
- <button type="submit" value="'.$row->surveyee_id.'" class="btn btn-warning" name="btnEdit"><span class="glyphicon glyphicon-edit"></span></button>
- </td>
- <td style="width: 10px">
- <button type="submit" class="btn btn-success" name="btnInsert" id="insertbtn" onclick="redirect()"><span class="glyphicon glyphicon-plus"></span></button>
- </td>
- </tr>
- ';
- }
- ?>
- </tbody>
- </table>
- </div>
- </div>
- <!-- /. Display data in a table-->
- </form>
- </div>
- </section>
- <!-- /.content -->
- </div>
- <!-- /.content-wrapper -->
- <script type="text/javascript">
- function redirect() {
- let url = window.location.origin;
- window.location.replace(url+'/children_info.php');
- // location.replace("https://www.w3schools.com")
- }
- </script>
- <!--<script>
- $(document).ready(function(){
- $("#insertbtn").click(function(){
- // alert('#insert23');
- var children_page = "http://localhost/survey/children_info.php";
- document.location.href = "children_page";
- });
- });
- </script>-->
- <!--<script type="text/javascript">
- $(document).ready(function () {
- $("#insertbtn").click(function () {
- $(location).attr('href','http://localhost/survey/children_info.php')
- })
- });
- </script>-->
- <?php
- include_once 'footer.php';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement