<?PHP

ob_start();

session_start();

include 'connect.php';

if(isset($_SESSION['adminemail']))

{

$user=$_SESSION['adminemail'];



$gtp=mysql_query("select * from admin where username='$user'");

$gtp1=mysql_fetch_array($gtp);



include 'top.php';

?>







			<div class="main-content">

				<div class="main-content-inner">

					<div class="breadcrumbs ace-save-state" id="breadcrumbs">

						<ul class="breadcrumb">

							<li>

								<i class="ace-icon fa fa-home home-icon"></i>

								<a href="#">Home</a>

							</li>

							<li class="active">New Project</li>

						</ul><!-- /.breadcrumb -->

					</div>



					<div class="page-content">

			



						<div class="page-header">

                        

<?php



$aca=mysql_query("select * from financial where user='$user' order by ID desc");

$aca1=mysql_fetch_array($aca);



$financial=$aca1['financial'];



?>

                        

                        <table style="width:100%;">

                        

                        <tr><td style="width:50%;">

                        

							<h1>

								New Project

							</h1>

                            

                            </td>

                            

                            <td style="width:50%; text-align:right; padding-right:15px; font-size:15px;">

                            

                            <i class="fa fa-calendar"></i>&nbsp; <?php echo $financial; ?>

                            

                            </td></tr></table>

                            

						</div><!-- /.page-header -->



						<div class="row">

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

                            

								<!-- PAGE CONTENT BEGINS -->



<script src="assets/js/jquery.js"></script>



<script>



$(".state").live('change',function() {



		  var state=$(this).val();



		  var dataString = 'state='+ state;



		  //alert(dataString);



		  $.ajax



		  ({



		  type: "GET",



		  url: "getdistrict.php",



		  data: dataString,



		  cache: false,



		  success: function(resp)



		  {

		  

		  $('.district').html($('#district',resp).html());



		  }



		  });



});





$(".district").live('change',function() {



		  var district=$(this).val();



		  var dataString = 'district='+ district;



		  //alert(dataString);



		  $.ajax



		  ({



		  type: "GET",



		  url: "gettaluk.php",



		  data: dataString,



		  cache: false,



		  success: function(resp)



		  {

		  

		  $('.taluk').html($('#taluk',resp).html());



		  }



		  });



});





$(".taluk").live('change',function() {



		  var taluk=$(this).val();



		  var dataString = 'taluk='+ taluk;



		  //alert(dataString);



		  $.ajax



		  ({



		  type: "GET",



		  url: "getvillage.php",



		  data: dataString,



		  cache: false,



		  success: function(resp)



		  {

		  

		  $('.village').html($('#village',resp).html());



		  }



		  });



});







$(document).ready(function(){



$('.mobile').blur(function(){

	

		  var mobile=$('.mobile').val();

		  var dataString = 'mobile='+ mobile;

		  //alert(dataString);

		  $.ajax

		  ({

		  type: "GET",

		  url: "getmob.php",

		  data: dataString,

		  cache: false,

		  success: function(html)

		  {

			

			//alert(html);

			var warn=$(html).filter('#warn').text();



			if(warn>0)

			{

				alert("Mobile no already exist.");

			}

			

		  }

		  });



});



});





</script>



<script>

	

jQuery(function($){

		   

	// simple jQuery validation script

	$('#course').submit(function(){

		

		var valid = true;

		var errormsg = 'This field is required!';

		var errorcn = 'error';

		

		$('.' + errorcn, this).remove();			

		

		$('#required', this).each(function(){

			var parent = $(this).parent();

			if( $(this).val() == '' ){

				var msg = $(this).attr('title');

				msg = (msg != '') ? msg : errormsg;

				$('<span style="font-size:13px;color:#FF0000; padding-left:3px;" class="'+ errorcn +'">'+ msg +'</span>')

					.appendTo(parent)

					.fadeIn('fast')

					.click(function(){ $(this).remove(); });

				valid = false;

			};

		});

		

		var mob=$('.mobile').val().length;

		

		//alert(mob);

		

		if(mob<10)

		{

			alert("Enter Valid Mobile No");

			valid = false;

		}

		

		return valid;

		

		$('button:submit').prop('disabled', true);

		

	});

	

});	



</script>







<?php        



if(isset($_POST['submit'])) 

{



$name=$_POST['name'];

$fathername=$_POST['fathername'];

$mobile=$_POST['mobile'];

$qualification=$_POST['qualification'];

$state=$_POST['state'];

$district=$_POST['district'];

$taluk=$_POST['taluk'];

$village=$_POST['village'];

$totalacre=$_POST['totalacre'];

$crops=$_POST['crops'];

$experience=$_POST['experience'];

$business=$_POST['business'];

$remarks=$_POST['remarks'];

$followdate=$_POST['followdate'];



$followdate=date('Y-m-d',strtotime($followdate));



$ins=mysql_query("insert into newproject(name,fathername,mobile,qualification,state,district,taluk,village,totalacre,crops,agricultureexperience,business,remarks,nextfollowup) values('$name','$fathername','$mobile','$qualification','$state','$district','$taluk','$village','$totalacre','$crops','$experience','$business','$remarks','$followdate')") or die(mysql_error());



if($ins)

{

	header("location:viewnewproject.php?s=1");

}

else

{

	header("location:viewnewproject.php?s=2");

}



}



else 

{



$sel=mysql_query("select * from admin where username='$user'");

$nmrw=mysql_num_rows($sel);

$sel1=mysql_fetch_array($sel);



?>



<form id="course" action="newproject.php" method="post">



<table width="70%" style="margin:auto; line-height:35px;">



<tr><td>Name <span class="red">*</span></td><td>:</td><td><input type="text" name="name" required autocomplete="off" /></td></tr>



<tr><td>Father Name </td><td>:</td><td><input type="text" name="fathername" autocomplete="off" /></td></tr>



<tr><td>Mobile <span class="red">*</span></td><td>:</td><td><input type="text" name="mobile" class="mobile" required maxlength="10" autocomplete="off" /></td></tr>



<tr><td>Qualification</td><td>:</td><td><input type="text" name="qualification" /></td></tr>



<tr><td>State</td><td>:</td><td><select name="state" class="state" style="width:220px;"><option value="">-- Select --</option>



<?php



$ste=mysql_query("select * from statecode order by ID asc");

while($ste1=mysql_fetch_array($ste))

{

	echo"<option value='".$ste1['ID']."'>".$ste1['state']."</option>";

}



?>



</select></td></tr>



<tr><td>District</td><td>:</td><td><select name="district" class="district" style="width:220px;"><option value="" selected="selected">-- Select --</option></select></td></tr>





<tr><td>Taluk</td><td>:</td><td><select name="taluk" class="taluk" style="width:220px;"><option value="" selected="selected">-- Select --</option></select></td></tr>





<tr><td>Village</td><td>:</td><td><select name="village" class="village" style="width:220px;"><option value="" selected="selected">-- Select --</option></select></td></tr>





<tr><td>Total Acre</td><td>:</td><td><input type="text" name="totalacre" /></td></tr>



<tr><td>Crops</td><td>:</td><td><input type="text" name="crops" autocomplete="off" /></td></tr>



<tr><td>Agriculture Experience</td><td>:</td><td><input type="text" name="experience" autocomplete="off" /></td></tr>



<tr><td>Business</td><td>:</td><td><input type="text" name="business" style="width:220px;" /></td></tr>



<tr><td>Remarks</td><td>:</td><td><textarea name="remarks"></textarea></td></tr>



<tr><td>Next Follow Up Date</td><td>:</td><td><input type="text" name="followdate" autocomplete="off" class="popupdatepicker" /></td></tr>



<tr><td colspan="3" style="text-align:center; padding-top:7px;"><button type="submit" name="submit" class="btn btn-sm btn-primary">Submit</button></td></tr>



</table>



</form>



<?php



}

	

?>

                                                                

        

								



										<!-- PAGE CONTENT ENDS -->

									</div><!-- /.col -->

								</div><!-- /.row -->

							</div><!-- /.page-content -->

						</div>

					</div><!-- /.main-content -->







<?php

include 'bottom.php';

}

else

{



 header("location:login.php");

}

ob_flush();



?>