<?php
include("includes/useAVclass.php");
require_once "includes/connection.php";
require_once("includes/config.inc.php");
require_once "includes/functions.inc.php";
require_once "includes/functions-data.php";
//require_once "design.php";
$useAVclass = new useAVclass();
$useAVclass->connection(); 
  

@extract($_GET);
@extract($_POST);
@extract($_SESSION);



	 
if(isset($_POST['mydata']))
{

  if ($_POST['mydata'] == 'thisdata') {
 
  
  $salt =rand(19999, 29999);
  $salt1 =rand(31999, 59999);
  
	$partnerid =content_desc(check_input($_POST['partnerid']));
	$user_name = content_desc(check_input($_POST['user_name']));
	$gender =content_desc(check_input($_POST['gender']));
	$address =content_desc(check_input($_POST['address']));
	$user_phone =content_desc(check_input($_POST['user_phone']));
	$aadhar_no =content_desc(check_input($_POST['aadhar_no']));
	$state =content_desc(check_input($_POST['state']));
	$district =content_desc(check_input($_POST['district']));
	$pincode =content_desc(check_input($_POST['pincode']));
	$latitude =content_desc(check_input($_POST['latitude']));
	$lognitude =content_desc(check_input($_POST['lognitude']));
	
	
	
	 $errormsg="";

   $data = array('success' => false, 'messages' => array());  
  if($partnerid == ''){

    $errormsg .= "partnerid,";

  }

  if($user_name == ''){

    $errormsg .= "user_name,";

  }

/*  if($aadhar_no == ''){

    $errormsg .= "indentity_type,";

  }*/



  if($gender == ''){

    $errormsg .= "gender,";

  }

  if($state == ''){

    $errormsg .= "state,";

  }

  if($district == ''){

    $errormsg .= "district,";

  }

 
  if($user_phone == '' ||  !preg_match('/^[0-9]{10}+$/', $user_phone) ){

    $errormsg .= "user_phone,";

  }

  // 

  if($pincode == '' || !preg_match('/^[0-9]{6}+$/', $pincode) ){

    $errormsg .= "pincode,";

  }
    if($address == ''){

    $errormsg .= "address";

  }



if($errormsg == '')
{

	  $date=date('Y-m-d'); 	
		$tableName_send="volunteer_login";
		
 
		$tableFieldsName_send=array("partner_id","user_name","gender","address","user_phone","aadhar_no","state","district","pincode","latitude","lognitude","user_type","indentity_type","other_spot");
		$tableFieldsValues_send=array("$partnerid","$user_name","$gender","$address","$user_phone","$aadhar_no","$state","$district","$pincode","$latitude","$lognitude","3","$indentity_type","$other_spot");
		$useAVclass->insertQuery($tableName_send,$tableFieldsName_send,$tableFieldsValues_send,$pdo);
		$id = $pdo->lastInsertId();
		  
    $data = array('success' => true, 'messages' => $id);

   
	//	header("location:thanks.php");
  }
  else
  {

    $error = explode(',', $errormsg);

  //  $data['messages'] =  $error;
     foreach ( $error  as $key => $value) {

                $data['messages'][$key] = $value;
            } 

            
  }

   echo json_encode($data);

       exit();
      


  }

}

?>


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>IFSA</title>
<!-- Bootstrap Core CSS -->
  <link href="assets/css/bootstrap.min.css" rel="stylesheet">
        <!-- Icon CSS -->
        <link href="assets/css/font-awesome.min.css" rel="stylesheet">
        <link href="assets/css/icofont.css" rel="stylesheet">
        
        <!-- Owl Carousel CSS -->
        <link rel="stylesheet" href="assets/css/owl.carousel.css">
        <!-- Main Style -->
        <link href="assets/css/style.css" rel="stylesheet">
        <!-- Responsive CSS -->
        <link href="assets/css/responsive.css" rel="stylesheet">
        <!-- Favicon -->
        <link rel="shortcut icon" type="image/png" href="assets/image/favicon.png">
    <style type="text/css">
          select {
            font-size: 12px !important;
          }
        </style>
<!-- Menu Access for Tab Key -->
<script src="js/superfish.js"></script>
<script type="text/javascript" src="js/validatejs.js"></script>
<script src="js/jquery.js" type="text/javascript"> </script>
<script src="js/jquery.meanmenu.js"></script>
<script type="text/javascript">
jQuery(document).ready(function () {
    jQuery('#main-nav nav').meanmenu();
});

</script>


<script>
var x = document.getElementById("demo");
getLocation();
function getLocation() {
    if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(showPosition);
    } else { 
        //x.innerHTML = "Geolocation is not supported by this browser.";
    }
}

function showPosition(position) {
var lat=position.coords.latitude;
var long=position.coords.longitude;

$("#latitude").val(lat);
$("#lognitude").val(long);

  $.ajax({
        url: "auth/webservices/test.php",  
        type: "POST", 
        data: {"lat":lat , "long":long},     
        cache: false,
       dataType: "json",
        success: function (msg) { 
        //alert("hello"); 
         $("#address").val(msg.results[0].formatted_address);
         length=msg.results[0].address_components.length-1;
$("#pincode").val(msg.results[0].address_components[length].long_name);
        }       
    });   


    // x.innerHTML = "Latitude: " + position.coords.latitude + 
    // "<br>Longitude: " + position.coords.longitude;



}
</script>


<script type="text/javascript" src="js/jquery.validate.min.js"></script>
<script type="text/javascript">
   jQuery.validator.addMethod("alphanumeric", function(value, element) {
    return this.optional(element) || /^\w+$/i.test(value);
}, "Letters, numbers, and underscores only please");

 jQuery.validator.addMethod("alpha", function(value, element) {
    return this.optional(element) || value == value.match(/^[a-zA-Z]+$/);
 });


(function($,W,D)
{
	//alert("fffff");
    var JQUERY4U = {};

    JQUERY4U.UTIL =
    {
        setupFormValidation: function()
        {
            //form validation rules
            $("#contact_form").validate({
				
                rules: {
                  
					
					txtphone: {
								required: true,
								number: true,
								minlength: 10
						},
					//user_name: "required",
					//father_name: "required",
					//state: "required",	
					//district: "required",
					//gender: "required",
					//pincode: "required",	
					//aadhar_no: "required",
					//lognitude: "required",
					//lognitude: "required",
					//user_phone: "required",
					//address: "required",
                },
               
				
				
				messages: {
				 
				//  user_name: "Please Enter Name",
				//   father_name: "Please Enter Father Name",
				//   state: "Please Select State",
               //   district: "Please Enter District",
				//  gender: "Please Select Gender",
					//pincode: "Please  Enter Pincode",
					//user_phone: "Please Enter Contact Number that should be 10 to 12 digits",
					//aadhar_no: "Please  Enter Aadhar No.",
					//lognitude: "Please Enter Logintude",
					//lognitude: "Please  Enter Lognitude",
					//address: "Please Enter Address",
					
					  
                },
                submitHandler: function(form) {
                    form.submit();
                }
            });
        }
    }

    //when the dom has loaded setup form validation rules
    $(D).ready(function($) {
	
        JQUERY4U.UTIL.setupFormValidation();
    });

})(jQuery, window, document);
</script>
<script type="text/javascript">
$(document).ready(function(){
 //  alert("fffff");
    $('#user_phone').keyup(function(){
        var user_phone = $(this).val(); // Get txtename textbox using $(this)
		// alert($('#user_phone').attr('id'));
		
        var Result = $('#result'); // Get ID of the result DIV where we display the results
        if(user_phone.length > 9) { // if greater than 2 (minimum 3)
            Result.html('Loading...'); // you can use loading animation here
            var dataPass = 'user_phone='+user_phone;
			//alert(dataPass);
            $.ajax({ // Send the txtename val to available.php
            type : 'POST',
            data : dataPass,
            url  : 'available.php',
            success: function(responseText){ // Get the result
				//alert(responseText);
              	if(responseText > 0){
                    Result.html('<span class="error">Phone no. already exist</span>');
                }
                else{
                	//alert('Problem with sql query');
                	Result.html('');
                }
            }
            });
        };
     
    });
	
	

});
</script>

<style type="text/css">
  .col-md-6 {
    width: 50%;
    padding: 10px;
}
</style>

</head>
<body class="single-service">
        <!-- start #main-site-wrapper -->
        <main id="main-site-wrapper">
            <!-- start .header-area -->
            
            <script src="w3.js"></script>
            <div w3-include-html="menus.html" corssorigin="false"></div>
            <script>
                 w3.includeHTML();
            </script>
            
            <!-- start section .page-header -->
            <!-- start section .page-header -->
            <section class="page-header valigncenter text-center">
                <div class="container">
                    <div class="row">
                        <div class="col-xs-12" style="    margin-bottom: -100px;">
                            <h1>Volunteer Registration</h1>
                            <!-- <ol class="breadcrumb">
                                <li><a href="index.html">Home</a></li>
                                <li class="active">Volunteer Registration</li>
                            </ol>  --><!-- end .breadcrumb -->
                        </div> <!-- end .col-** -->
                    </div> <!-- end .row -->
                </div> <!-- end .container -->
            </section> <!-- end .page-header -->
            
            <!-- start section -->
            <section class="section-padding">
                <div class="container">
                    <div class="row">
                        <div class="col-xs-12">
                             <!-- start .page-inner -->
                            <div class="page-inner">
                                <div class="row">
                                    <div class="col-md-12">
                                       <section class="pb30 pt30">

<!-- Logo Part Start --> 

<!-- Menu Part End --> 

<!-- Menu Part End --> 

<!-- <div class="container-fluid header-img-m home_bg"> 
	<div class="container header-content">
        <h1>We care because<br><span>Eyes are precious!</span></h1>
		<h2>Integrated technology that enable <br> us to stand above the rest...</h2>
			<a href="<?php echo $HomeURL;?>/auth/appointments.php" class="btn btn-lg btn-primary">Book an Appointment</a>
	
      </div>
</div> --> 

<!--Carousel End --><div class="container content-area about-us-home-margin">
  <div class="col-md-12">
    <h2>Volunteer Registration</h2>
    <hr>
	</div>
   
    <div class="col-md-12 form-style about-us-content-home">

        <?php 
      if($errormsg != ''):
        echo '<div style="color: red;">'.$errormsg.'</div>';
      endif;
    ?>
      
	<div class="reg_form">
      <form id="contact_form" method="post" class="" name='contact_form'>
        <?php	
if($_GET['editid']!='')
{

$edit = $pdo->prepare('select * from vendor_login_new where id= ? ');
//echo 'select * from vendor_login where id= 1';
		$edit->execute(array($_GET['editid']));
		$rr = $edit->fetch();
}
?>
        <fieldset>
          <legend>Volunteer Details</legend>
          <div class="col-md-6">
		  <div class="form-group">
            <label for="partnerid" class="control-label">Currently working with  : </label>
    <div class="input-group"> <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>

			<select name="partnerid" placeholder="`Currently Working With`" id="partnerid" class="form-control" autocomplete="off">
	<option value=""> Select </option>
	 <?php 
	$data = $pdo->query("SELECT * FROM partner_login group by org_name");
while($role_module = $data->fetch())
{
		
		?>
		<option value="<?php echo $role_module['id'];?>" <?php if ($role_module['id']==$partnerid) echo 'selected="selected"';?>><?php echo $role_module['org_name']; ?></option>
		<?php }
	?>
	<option value="20" <?php if ($role_module['id']=='20') echo 'selected="selected"';?>>Other</option>
			</select>
 
    </div>
</div>
</div>
          <div class="col-md-6">
		  <div class="form-group">
            <label for="user_name" class="control-label">Name: </label>
              <div class="input-group"> <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
                <input type="text" id="user_name" class="form-control"  placeholder="Name" name="user_name" value="<?php if($_POST['user_name']!=""){ echo $_POST['user_name'];} else { echo $rr['user_name'];} ?>" onKeyPress="return LettersWithSpaceOnly(event);">
                <br/>
              </div>
          </div>
		  </div>
		 
		 <div class="col-md-6">
          <div class="form-group">
            <label for="state" class="control-label">State : </label>
              <div class="input-group"> <span class="input-group-addon"><i class="glyphicon glyphicon-map-marker"></i></span> 
                <!-- <input type="text" id="state" class="form-control" placeholder="State" name="state" required value="<?php if($state!='') { echo $state; } else {};?>"> -->
                 <select name="state" id="state" placeholder="State" class="form-control" autocomplete="off" onChange="getdistrict(this.value);">
				<option value=""> Select </option>
				<?php 
				$data = $pdo->query("SELECT * from state where c_status='1' order by c_name");
				while($role_module = $data->fetch())
				{

				?>
				<option value="<?php echo $role_module['c_id'];?>" <?php if ($role_module['c_id']==$state) { echo 'selected="selected"';}?>><?php echo $role_module['c_name']; ?></option>
				<?php }
				?>
				</select>
              </div>
            </div>
          </div>
		  <div id="dis">
		  <div class="col-md-6">
          <div class="form-group">
            <label for="district" class="control-label">District :</label>
              <div class="input-group"> <span class="input-group-addon"><i class="glyphicon glyphicon-map-marker"></i></span>
                <select name="district" placeholder="District" class="form-control" id="district">
                  <option value=""> Select </option>
				<!--<?php 
				$data = $pdo->query("SELECT * from district where c_status='1'");
				while($role_module = $data->fetch())
				{

				?>
				<option value="<?php echo $role_module['c_name'];?>" <?php if ($c_name['c_id']==$district) { echo 'selected="selected"';} elseif($rr['state_id']==$role_module['c_id']) { echo "selected='selected'";}?>><?php echo $role_module['c_name']; ?></option>
				<?php }
				?>-->
                </select>
              </div>
            </div>
          </div>
		 </div>
		  <div class="col-md-6">
          <div class="form-group">
            <label for="Gender" class="control-label">Gender : </label>
              <div class="input-group"> <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
                <select name="gender" id="gender" placeholder="Gender" autocomplete="off" class="form-control">
				<option value="">Select</option>
                  <?php 
					//foreach($gender as $key=>$value1)
					//{
					//	?>
                  <!-- <option value="<?php echo $value1; ?>" <?php if($value1 == '1') { echo 'selected="selected"'; }  else { }?>><?php echo $value1; ?></option>
					<?php// }
					 ?>
					</select>   -->
                  <option value="Male"<?php if ($gender=='Male') { echo 'selected="selected"'; } elseif ($rr['gender']=='Male') { echo 'selected="selected"'; } ?>>Male</option>
                  <option value="Female"<?php if ($gender=='Female') { echo 'selected="selected"'; } elseif ($rr['gender']=='Male') { echo 'selected="selected"'; } ?>>Female</option>
                </select>
              </div>
            </div>
          </div>
         <div class="col-md-6">
          <div class="form-group">
            <label for="indentity_type" class="control-label">Identity Type : </label>
              <div class="input-group"> <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
                <select name="indentity_type" id="indentity_type" autocomplete="off" class="form-control">
                
                  <option value="1"<?php if ($indentity_type=='1') { echo 'selected="selected"'; } elseif ($rr['indentity_type']=='1') { echo 'selected="selected"'; } ?>>Aadaar Card</option>
                  <option value="2"<?php if ($indentity_type=='2') { echo 'selected="selected"'; } elseif ($rr['indentity_type']=='2') { echo 'selected="selected"'; } ?>>Pan Card</option>
				  <option value="3"<?php if ($indentity_type=='3') { echo 'selected="selected"'; } elseif ($rr['indentity_type']=='3') { echo 'selected="selected"'; } ?>>Voter Id</option>
                  <option value="4"<?php if ($indentity_type=='4') { echo 'selected="selected"'; } elseif ($rr['indentity_type']=='4') { echo 'selected="selected"'; } ?>>Other</option>
                </select>
              </div>
            </div>
          </div>
		 <!-- Text input-->
		  <div class="col-md-6">
          <div class="form-group">
            <label for="aadhar_no" class="control-label">Identity No. </label>
              <div class="input-group"> <span class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i></span>
                <input type="text" id="aadhar_no" class="form-control" placeholder="Identity No." maxlength="12" name="aadhar_no" value="<?php if($aadhar_no!='') { echo $aadhar_no; } { echo $rr['aadhar_no'];} ?>"   onkeypress="return isNumberDecimal(event);">
              </div>
            </div>
          </div>
		  <div class="col-md-6">
          <div class="form-group">
            <label for="user_phone" class="control-label">Mobile :</label>
              <div class="input-group"> <span class="input-group-addon"><i class="glyphicon glyphicon-earphone"></i></span>
                <input autocomplete="off" type="text" id="user_phone" class="form-control" placeholder="`10 Digits Number`" maxlength="10"  name="user_phone" autocomplete="off" value="<?php if($user_phone!='') { echo $user_phone; } else {}?>"  onkeypress="return isNumberDecimal(event);"><div class="result" id="result" align="center"></div>
              </div>
            </div>
          </div>

          <!-- Text area -->
		  <div class="col-md-6">
          <div class="form-group">
            <label for="name" class="control-label">Address : <!-- <span class="star">*</span> --></label>
              <div class="input-group"> <span class="input-group-addon"><i class="glyphicon glyphicon-map-marker"></i></span>
                <input autocomplete="off" type='text'  id="address" class="form-control" placeholder="Address" name="address" value="<?php if($address!='') { echo $address; } else { echo $rr['address']; }?>" onBlur="return getlocation2(this.value)"/>
                <?php //echo $rr['address'];?>
              </div>
            </div>
          </div>

		  <div class="col-md-6">
          <div class="form-group">
            <label for="pincode" class="control-label">Pincode : <!-- <span class="star">*</span> --></label>
              <div class="input-group"> <span class="input-group-addon"><i class="glyphicon glyphicon-map-marker"></i></span>
                <input type="text" id="pincode"  class="form-control" placeholder="Pincode" name="pincode"  maxlength="6" value="<?php if($pincode!='') { echo $pincode; } else {};?>" onKeyPress="return isNumberDecimal(event);">
              </div>
            </div>
          </div>
		  <!-- <div class="col-md-6">
          <div class="form-group">
            <label for="latitude" class="control-label">Latitude :</label>
              <div class="input-group"> <span class="input-group-addon"><i class="glyphicon glyphicon-earphone"></i></span>
                <input type="text"  id="latitude" class="form-control" readonly placeholder="Latitude" name="latitude" value="<?php if($latitude!='') { echo $latitude; } else {};?>" >
              </div>
            </div>
          </div>
		  <div class="col-md-6">
          <div class="form-group">
            <label for="lognitude" class="control-label">Longitude :</label>
              <div class="input-group"> <span class="input-group-addon"><i class="glyphicon glyphicon-earphone"></i></span>
                <input type="text" id="lognitude"  class="form-control" readonly placeholder="Longitude" name="lognitude" value="<?php if($lognitude!='') { echo $lognitude; } else {};?>" >
              </div>
            </div>
          </div>
		  <div class="col-md-6">
          <div class="form-group">
            <label for="other_spot" class="control-label">Food Sharing Spot Name :</label>
              <div class="input-group"> <span class="input-group-addon"><i class="glyphicon glyphicon-earphone"></i></span>
                <input type="text" id="other_spot" class="form-control" placeholder="Food Sharing Spot Name"  name="other_spot" value="<?php if($rr['other_spot']!='') { echo $rr['other_spot']; } else {};?>" >
              </div>
            </div>
          </div>  -->
          <div class="clearfix"></div>
          <!-- Button -->
          <div class="col-md-12">
          <div class="form-group text-center">
              <input type="submit" name="cmdsubmit" id="cmdsubmit" value="Submit" title="Submit" class="btn btn-warning" />
              &nbsp;&nbsp;
              <input type="reset" class="btn btn-warning"  name="cmdreset" title="Reset" value="Reset">
            </div>
          </div>
        </fieldset>
      </form>
    </div>
	</div>
  
</div>

<!-- Footer part --> 

<!-- Footer part -->

      </div> <!-- end .row -->
                            </div> <!-- end .page-inner -->
                        </div> <!-- end .col-** -->
                    </div> <!-- end .row -->
                </div> <!-- end .container -->
            </section> <!-- end section -->

            <!-- start section -->
            

             <!-- start section -->
            <section class="section-padding">
                <div class="container">
                    
                </div> <!-- end .container -->
            </section> <!-- end section -->
<!-- Footer part --> 

<!-- Footer part -->

 <!-- start .footer-area -->
            <footer class="footer-area bg-gray">
              <script src="w3.js"></script>
<div corssorigin="false" w3-include-html="footer.html">    <br/><br/></div>
<script>
	 w3.includeHTML();
</script>
            </footer> <!-- end footer -->
        </main> <!-- end #main-site-wrapper -->
        <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
        <script src="assets/js/jquery-1.12.4.min.js"></script>
        <!-- Include all compiled plugins (below), or include individual files as needed -->
        <!-- Bootstrap JS -->
        <script src="assets/js/bootstrap.min.js"></script>
        <!-- Owl JS -->
        <script src="assets/js/owl.carousel.min.js"></script>
        <!-- Theme Scripts JS -->
        <script src="assets/js/scripts.js"></script>  
 
<!-- Footer part --> 
<!-- Footer part --> 
<!-- <a href="<?php echo $HomeURL;?>/auth/appointments.php" rel="lightframe" class="lightbox-processed"><img src="<?php echo $HomeURL;?>/images/book-appointment.png" id="ext-link-left1"></a>   --> 
<!--This is for gallery --> 
<!-- Footer part --> 
<!-- Footer part --> 
<!-- <a href="<?php echo $HomeURL;?>/auth/appointments.php" rel="lightframe" class="lightbox-processed"><img src="<?php echo $HomeURL;?>/images/book-appointment.png" id="ext-link-left1"></a>   --> 
<!--This is for gallery --> 

<script>
$(document).ready(function(){
    $(".nav-tabs a").click(function(){
        $(this).tab('show');
    });
});
</script> 

<!--<script type="text/javascript" src="js/jsDatePick.js"></script>
<link href="css/jsDatePick.css" rel="stylesheet" type="text/css" />--> 

<script type="text/javascript">
function getPage(id) {
//alert(id);
    //generate the parameter for the php script
    var data = 'cat=' + id;
	//alert(data);
    $.ajax({
        url: "category.php",  
        type: "POST", 
        data: data,     
        cache: false,
        success: function (html) {  
         
            //hide the progress bar
            $('#loading').hide();   
             
            //add the content retrieved from ajax and put it in the #content div
            $('#cat').html(html);
             
            //display the body with fadeIn transition
            $('#content2').fadeIn('slow');       
        }       
    });
}

function getdistrict(id) {
//alert(id);
    //generate the parameter for the php script
    var data = 'dis=' + id;
	//alert(data);
    $.ajax({
        url: "getcity.php",  
        type: "POST", 
        data: data,     
        cache: false,
        success: function (html) {  
         
            //hide the progress bar
            $('#loading').hide();   
             
            //add the content retrieved from ajax and put it in the #content div
            $('#dis').html(html);
             
            //display the body with fadeIn transition
            $('#content2').fadeIn('slow');       
        }       
    });
}

function getlocation(val) {
 var address = val;
// alert(data);
    $.ajax({
        url: "getcordinate.php",  
        type: "POST", 
        data: {"address":address},     
        cache: false,
        dataType: "json",
        success: function (msg) {  
         $("#latitude").val(msg.results[0].geometry.location.lat);
$("#lognitude").val(msg.results[0].geometry.location.lng);
length=msg.results[0].address_components.length-1;
//$("#pincode").val(msg.results[0].address_components[length].long_name);
        }       
    });
}
/*function getPage1(id) {
//alert(id);
    //generate the parameter for the php script
    var data = 'did=' + id;
	
	
	//alert(data);
    $.ajax({
        url: "doctor_timing.php",  
        type: "POST", 
        data: data,     
        cache: false,
        success: function (html) {  
         
            //hide the progress bar
            $('#loading').hide();   
             
            //add the content retrieved from ajax and put it in the #content div
            $('#did').html(html);
             
            //display the body with fadeIn transition
            $('#content2').fadeIn('slow');       
        }       
    });
}*/


function getPage2() {

    //generate the parameter for the php script
    //var data = 'did2=' + id;
	
	//var data = 'did2='+ id+ '&dname='+ docter_name;
	 //var data: 'did2='+id+'&dname='+docter_name;
var day=$("#example2").val();
var dname=$("#doctor_name").val();
var loc=$("#location").val();
//alert(day);
//alert(dname);
//alert(#location);
	
    $.ajax({
type: "POST",
url: "timing.php",
data:"day="+day+"&dname="+dname+"&loc="+loc,
			
	//alert(data);
        cache: false,
        success: function (html) {  
         //alert(html);
            //hide the progress bar
            $('#loading').hide();   
             
            //add the content retrieved from ajax and put it in the #content div
            $('#example23').html(html);
             
            //display the body with fadeIn transition
            $('#content2').fadeIn('slow');       
        }       
    });
}

 

 
$("#contact_form").submit(function(event) {     	
    event.preventDefault();
	 mydata =  $(this).serialize();


	$.ajax({

		type:'post',
		url:'volunteer_registration.php',
		data:'mydata=thisdata&'+mydata,
     dataType:'json',
		success:function(htm){

       
			 
       if(htm.success == true ) {

         
         window.location="thanks.php";

       }
       else
       {
           $.each(htm.messages,function(key,value){
                    var element = $('#'+value);
                       var data_name = $('#'+value).attr('placeholder');
                    element.closest('div.input-group')
                    .removeClass('has-error')
                    .addClass(value ? 'has-error':'has-success')
                     .parent('div').find('.text-danger').remove();

                    element.parent('div.input-group').after('<span style="color:red;z-index: 9999999;position: absolute;width: 100%;" class="text-danger">Please fill valid  details for '+data_name+'</span>');

              });

       }

      
				
		},
		error:function()
		{

		}

	});	


});



</script> 
<script type="text/javascript">
$(".closestatus").click(function() {
$("#msgerror").addClass("hide").hide();
});
$(".closestatus").click(function() {
$("#msgclose").addClass("hide").hide();
});

</script>
</body>
</html>