
<?php include'../pages/header.php'?>
<?php include'../pages/navbar.php'?>
<?php include'../../conn.php'?>
<!--//////////////////////////////doctor fetch array///////////////-->
 <?php
      $id=$_GET['id'];     
    $membershipsql="select * from membership where id='$id'";
    $membershipresult = mysqli_query($con,$membershipsql);
    $membershipsarry=array(); 
    while($membershiprow = mysqli_fetch_array($membershipresult)){
        $membershipsarry[]=$membershiprow;
    }
             
 ?>
<!--//////////////////////////////doctor fetch array///////////////-->
<!-- ///////////////////register new doctor up funcation////////////////// -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function (e) {
 $("#form").on('submit',(function(e) {
  e.preventDefault();
  $.ajax({
   url: "api/edit.php",
   type: "POST",
   data:  new FormData(this),
   contentType: false,
         cache: false,
   processData:false,
   beforeSend : function()
   {
    //$("#preview").fadeOut();
    $("#err").fadeOut();
   },
   success: function(data)
      {
        //  alert(data)
    if(data == 101)
    {
     // invalid file format.
     
     $("#successmessage").html("Sucessfully EDIt").fadeIn();
    
     location.reload(true);
    }
   
   
    else{
    	alert(data);
    }
      },
     error: function(e) 
      {
   $("#successmessage").html("Some thing went  worng").fadeIn().style.color.red;
      }          
    });
 }));
});
</script>
<!-- //////////////////register new doctor//////////////////////////// -->
<div class="content-wrapper">

<div class="container-fluid">

<div class="row">
<div class="col-sm-12 p-0">
<div class="main-header">
<h4>Edit</h4>

</div>
</div>
 </div>
<span class="successmessage" id="successmessage"></span>


<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header">
<!--<h5 class="card-header-text">Form wizard with Validation</h5></div>-->
<div class="card-block">
<div id="wizard">
<section>
    <?php foreach($membershipsarry as $data){ ?>
<form  action="#" method="post" id="form"  enctype="multipart/form-data" novalidate>
    <input id="id" name="id" type="hidden" class="required md-form-control" value="<?php echo $data['id']?>">
<h3> Edit </h3>
<fieldset>

<div class="md-group-add-on">
<span class="md-add-on">
<i class="icofont icofont-ui-membership"></i>
</span>
<div class="md-input-wrapper">
<input id="name" name="name" type="text" class="required md-form-control" value="<?php echo $data['name']?>">
<label for="membershipName-2" class="block">name *</label>
</div>
</div>

<div class="md-group-add-on">
<span class="md-add-on">
<i class="icofont icofont-ui-membership"></i>
</span>
<div class="md-input-wrapper">
<input id="slug" name="slug" type="text" class="required md-form-control" value="<?php echo $data['slug']?>">
<label for="membershipName-2" class="block">slug *</label>
</div>
</div>

<div class="md-group-add-on">
<span class="md-add-on">
<i class="icofont icofont-ui-membership"></i>
</span>
<div class="md-input-wrapper">
<input id="description" name="description" type="text" class="required md-form-control" value="<?php echo $data['description']?>">
<label for="membershipName-2" class="block">description *</label>
</div>
</div>

<?php }?>
</fieldset>
<div class="md-input-wrapper">
<button type="submit" id="btn" class="btn btn-primary waves-effect waves-light">Submit
</button>
</div>
</form>
</section>
</div>
</div>
</div>
</div>
</div>





<?php include'../pages/footer.php'?>
