<?php



include("checklogin.php");



include("../includes/inc.php");







$metatitle ="Edit Partner Detail";



include("header.php");







?>



<section class="content-header mt-2">



  <div class="container-fluid">



    <div class="row mb-2">



      <div class="col-sm-6">



        <h6>Edit Partner Detail</h6>



      </div>



      <div class="col-sm-6 text-right">



         <ol class="breadcrumb float-sm-right">



          <li class="breadcrumb-item"><a href="<?php echo ADMIN_SITE_URL;?>"> <i class="fa fa-dashboard"></i> Dashboard</a></li>



          <li class="breadcrumb-item"><a href="<?php echo ADMIN_SITE_URL ?>/general_inquiry.php?status=N">General Inquiry</a></li>



          <li class="breadcrumb-item active">Edit General Detail</span></a></li>



        </ol>



      </div>



    </div>



  </div><!-- /.container-fluid -->



</section>







<section class="content-header mt-4">



  <div class="container-fluid"> 



    <?php



    if($_POST['pID']=='addeditForm') {







      $_REQUEST['slno'] = $_POST['slno'];







      if(!empty($_POST['slno'])) {







        //, state = '".$_POST['state']."', city = '".db_real_escape($_POST['city'])."'



        db_query("UPDATE general_inq SET contact_name = '".db_real_escape($_POST['contact_name'])."', email = '".$_POST['email']."', mobile_phone = '".$_POST['mobile_phone']."', country = '".db_real_escape($_POST['country'])."', status='".$_POST['status']."' WHERE slno='".$_POST['slno']."' ");



          ?>



        <script type="text/javascript">



        window.location.href = "<?php echo ADMIN_SITE_URL;?>/edit_npartner_general_inquiry.php?success_msg=Y&slno=<?php echo $_REQUEST['slno']?>";  



        </script>



        <?php



        exit;



    }



  }







    if(!empty($_REQUEST['slno'])) {



      $req_qry = db_query("SELECT * FROM general_inq WHERE slno ='".$_REQUEST['slno']."'");







      if(db_num_rows($req_qry)>0) {



        $reqArr = db_fetch_assoc($req_qry);







        $_POST['contact_name'] = $reqArr['contact_name'];  



        $_POST['email']        = $reqArr['email'];                



        $_POST['mobile_phone'] = $reqArr['mobile_phone'];  



        $_POST['country']     =   $reqArr['country'];  

        $_POST['inquiry_for']     =   $reqArr['inquiry_for'];  

        $_POST['your_query']     =   $reqArr['your_query'];  



        //$_POST['city']        = $reqArr['city'];                



        //$_POST['address']    = $reqArr['address'];        



        $_POST['status']    = $reqArr['status'];        



      }  



    }    



    ?>



    <form name="searchfrm" action="<?php echo $_SERVER['PHP_SELF']?>" method="post" data-parsley-validate autocomplete="off" enctype="multipart/form-data">



      <div class="row">



        <div class="col-md-12 col-sm-12 col-xs-12">



          <div class="x_panel">          



            <div class="x_content">



            <?php            



            if(isset($_REQUEST['success_msg']) && $_REQUEST['success_msg']=='Y') {



              ?>



              <div class="text-center mt-3 text-success"><h2>New General Inquiry has Updated successfully</h2></div>



              <?php



            }



            else {



              ?>  



              <div class="form-group row"> 



                <label for="title_en" class="col-sm-3 form-control-label">* Your Name</label>



                <div class="col-sm-6">



                <input class="form-control" id="contact_name" required="" name="contact_name" type="text" value="<?php echo $_POST['contact_name']?>">



                </div>



              </div>







               <div class="form-group row"> 



                <label for="title_en" class="col-sm-3 form-control-label">* Mobile Number</label>



                <div class="col-sm-6">



                <input class="form-control" id="mobile_phone" required="" name="mobile_phone" type="text" value="<?php echo $_POST['mobile_phone']?>">



                </div>



              </div>







               <div class="form-group row"> 



                <label for="title_en" class="col-sm-3 form-control-label">* Email Address </label>



                <div class="col-sm-6">



                <input class="form-control" id="email" required="" name="email" type="text" value="<?php echo $_POST['email']?>">



                </div>



              </div>







                          







              <div class="form-group row">



              <label for="meta_title" class="col-sm-3 form-control-label">Your Query </label>



              <div class="col-sm-8">



              <textarea type="text" class="form-control" name="your_query" style="height:100px;"><?php echo $_POST['your_query']?></textarea>  



              </div>



              </div> 







              <div class="form-group row">



                <label for="title_en" class="col-sm-3 form-control-label">* Display Status</label>



                <div class="col-sm-5"> 



                  <select name="status" class="form-control" id="status">



                    <option value="">-- Select One--</option>
                    <?php
                    foreach ($status_arr as $key => $value) {
                      ?>
                      <option value="<?php echo $key?>" <?php echo ($_POST['status']==="$key")?('selected'):('');?>><?php echo $value?></option>
                      <?php 
                    }
                    ?>     
                  </select>
                </div>     
              </div> 
              <div class="form-group row">

                <label for="title_en" class="col-sm-3 form-control-label">&nbsp;</label>

                <div class="col-sm-5"> 
                <input type="hidden" name="pID" value="addeditForm">

                <input type="hidden" name="slno" value="<?php echo $_REQUEST['slno']?>">

                <button type="submit" class="btn-info bg-info text-white"><i class="fa fa-save"></i> SUBMIT</button>



                </div>



              </div>



              <?php



            }



            ?>



          </div>



        </div>



      </div>



    </div>



</form>



</div>



</section>











<?php



include("footer.php");



?>



</body>



</html>