<?php
ob_start();
//session_start();
//if(isset($_SESSION['loggedin']))
//{
	include('connection.php');
//	$logid=$_SESSION['loggedin'];
//	$res=mysqli_query($con,"select * from admin where id='$logid'");
//	$row=mysqli_fetch_assoc($res);

	$gid=$_REQUEST['bid'];
	$memm=mysqli_query($con,"select * from contact where id='$gid'");
	$brow=mysqli_fetch_assoc($memm);
	if(isset($_POST['save']))
{
$name=$_POST["name"];
$email=$_POST["email"];
$mobile=$_POST["mobile"];
$address=$_POST["address"];
date_default_timezone_set("Asia/Calcutta");
$date=date('Y-m-d H:i:s');

    	$sql="update contact set email='$email',mobile='$mobile',name='$name',address='$address',updated_at='$date' where id='$gid'";
	
   
    

$result=mysqli_query($con,$sql);
	if(mysqli_affected_rows($con)==1)
	{
		header("location:contact.php");
	}
	else{
	header("location:contact.php");
	}
}
	
?>

  <!-- Navbar -->
<?php include('header.php');?>
  <!-- /.navbar -->

  <!-- Main Sidebar Container -->
<?php include('sidebar.php');?>

  <!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
         
          
        </div>
      </div><!-- /.container-fluid -->
    </section>

    <!-- Main content -->
    <section class="content">
      <div class="container-fluid">
	  <div class="row">
             <div class="col-md-6">
            <!-- general form elements -->
               <div class="card card-info">
              <div class="card-header"style="background-color:rgb(27 125 151);color:white;">
                <h3 class="card-title"><b>Update Contact Info </b></h3>
              </div>
              <!-- /.card-header -->
              <!-- form start -->
			  <form method="post" method="post" enctype="multipart/form-data">
                <div class="card-body">
                    	<div class="form-group">
                    <label for="exampleInputEmail1">Name</label>
                    <input type="text" name="name" class="form-control" id="exampleInputEmail1" value="<?php echo $brow['name'];?>" >
                  </div>    
                  	<div class="form-group">
                    <label for="exampleInputEmail1">DRE#</label>
                    <input type="text" name="address" class="form-control" id="exampleInputEmail1" value="<?php echo $brow['address'];?>" >
                  </div> 
                   <div class="form-group">
                    <label for="exampleInputPassword1">Mobile No.</label>
                    <input type="text" name="mobile" class="form-control" id="exampleInputPassword1" value="<?php echo $brow['mobile'];?>" >
                  </div>    
				<div class="form-group">
                    <label for="exampleInputEmail1">Email ID</label>
                    <input type="email" name="email" class="form-control" id="exampleInputEmail1" value="<?php echo $brow['email'];?>" >
                  </div>                 
                 
    <!--           	 <div class="form-group">-->
			 <!--<label for="exampleInputPassword1">Description</label>-->
    <!--          <textarea id="summernote" name="address">-->
    <!--          <?php echo $brow['address'];?>-->
    <!--          </textarea>-->
    <!--        </div>-->
                				  
                </div>
                <!-- /.card-body -->
                <div class="card-footer" style="text-align:right">
                  <button type="submit" name="save" class="btn btn-info">Update</button>
                </div>
              </form>
			  
			  </div>           
          </div>
		 
      </div>
	 
	  </div><!-- /.container-fluid -->
    </section>
    <!-- /.content -->
  </div>
   <script src="plugins/jquery/jquery.min.js"></script>
<script src="plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="plugins/summernote/summernote-bs4.min.js"></script>
	
	<script src="plugins/summernote/summernote-bs4.min.js"></script>
	
	<script src="plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- AdminLTE App -->

	<script>
  $(function () {
    // Summernote
    $('#summernote').summernote()

    // CodeMirror
    CodeMirror.fromTextArea(document.getElementById("codeMirrorDemo"), {
      mode: "htmlmixed",
      theme: "monokai"
    });
  })
</script>
 <?php include('footer.php');?>