<?php include '../pages/header.php'?>
<?php include '../pages/navbar.php'?>

<!-- ///////////////////sign 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/add.php",
   type: "POST",
   data:  new FormData(this),
   contentType: false,
         cache: false,
   processData:false,
   beforeSend : function()
   {
    //$("#preview").fadeOut();
    $("#err").fadeOut();
   },
   success: function(data)
      {
    if(data == 101)
    {
     // invalid file format.
     
     $("#successmessage").html("Sucessfully Added").fadeIn();
     $("#form")[0].reset(); 
     $("#message").html("").fadeIn();
      window.location.href = "#";
    }
    
   
    else{
    	alert('Some thing went  wrong');
    }
      },
     error: function(e) 
      {
   $("#successmessage").html("Some thing went  wrong").fadeIn().style.color.red;
      }          
    });
 }));
});
</script>
<!-- //////////////////signup//////////////////////////// -->
<div class="content-wrapper">

<div class="container-fluid">

<div>

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

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

<div class="row">
<div class="col-md-6">
<div class="card">
<div class="card-header">
<!--<h5 class="card-header-text">Basic Form Validation</h5></div>-->
<div class="card-block">
<form  class="form-horizontal" action="#" method="post" id="form"  enctype="multipart/form-data" novalidate>
<div class="md-group-add-on p-relative">
<span class="md-add-on">
<i class="icofont icofont-ui-user"></i>
</span>
<div class="md-input-wrapper">
<input type="text" class="md-form-control" name="title" id="title">
<label for="username">Title</label>
</div>
</div>

<div class="md-group-add-on p-relative">
<span class="md-add-on">
<i class="icofont icofont-email"></i>
</span>
<div class="md-input-wrapper">
<textarea type="text" class="md-form-control" name="description" id="description">
    
</textarea>
<label for="email">Description</label>
 
</div>
</div>

<div class="md-group-add-on p-relative">
<span class="md-add-on">
<i class="icofont icofont-ui-password"></i>
</span>
<div class="md-input-wrapper">
<input type="text" class="md-form-control" name="authorname" id="authorname" >
<label for="password">Author Name</label>
<span class="messages"  ></span>
</div>
</div>


<div class="md-group-add-on p-relative">
<span class="md-add-on">
<i class="icofont icofont-phone"></i>
</span>
<label for="phone">User Type</label>
<div class="md-input-wrapper">
    


<select name="usertype" id="usertype" class="md-form-control">
    <option value="user">user</option>
    <option value="doctor">doctor</option>
</select>
<span class="messages"></span>
</div>
</div>

<div class="md-group-add-on p-relative">
<span class="md-add-on">
<i class="icofont icofont-file"></i>
</span>
<div class="md-input-wrapper">
<input type="file" class="md-form-control" name="thumbnail" id="thumbnail">
<label for="file">Select thumbnail </label>

</div>
</div>

<div class="md-group-add-on p-relative">
<span class="md-add-on">
<i class="icofont icofont-file"></i>
</span>
<div class="md-input-wrapper">
<input type="file" class="md-form-control" name="image" id="image">
<label for="file">Select image</label>

</div>
</div>

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

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