<?php
include('../db_connect.php');
if(isset($_POST['number'])){
	//header("location:vivek.php");
	$date = mysqli_real_escape_string($db,$_POST['month']);
	$number = mysqli_real_escape_string($db,$_POST['number']);
	$gender = mysqli_real_escape_string($db,$_POST['gender']);
	
	
	//echo $date."-".$gender."-".$number;

mysqli_query($db,"insert into suicide_data(number,month,gender) values ('$number','$date','$gender')");

	//echo "insert into important_contacts(name,address,phone,website,sector,email) values ('$name','$address','$phone','$website','$sector','$email')";
}

$con = mysqli_query($db,"select * from suicide_data order by id desc");
?>
<!DOCTYPE html>
<head>
<title>COCAP</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="Colored Responsive web template, Bootstrap Web Templates, Flat Web Templates, Android Compatible web template, 
Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyEricsson, Motorola web design" />
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
<!-- bootstrap-css -->
<link rel="stylesheet" href="css/bootstrap.css">
<!-- //bootstrap-css -->
<!-- Custom CSS -->
<link href="css/style.css" rel='stylesheet' type='text/css' />
<!-- font CSS -->
<link href='//fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
<!-- font-awesome icons -->
<link rel="stylesheet" href="css/font.css" type="text/css"/>
<link href="css/font-awesome.css" rel="stylesheet"> 
<!-- //font-awesome icons -->
<script src="js/jquery2.0.3.min.js"></script>
<script src="js/modernizr.js"></script>
<script src="js/jquery.cookie.js"></script>
<style>
	
td {
  word-break: break-all;
}

</style>
<script src="js/screenfull.js"></script>
		<script>
		$(function () {
			$('#supported').text('Supported/allowed: ' + !!screenfull.enabled);

			if (!screenfull.enabled) {
				return false;
			}

			

			$('#toggle').click(function () {
				screenfull.toggle($('#container')[0]);
			});	
		});
		</script>
<!-- charts -->
<script src="js/raphael-min.js"></script>
<script src="js/morris.js"></script>
<link rel="stylesheet" href="css/morris.css">
<!-- //charts -->
<!--skycons-icons-->
<script src="js/skycons.js"></script>
<!--//skycons-icons-->
</head>
<body class="dashboard-page">
	<script>
	        var theme = $.cookie('protonTheme') || 'default';
	        $('body').removeClass (function (index, css) {
	            return (css.match (/\btheme-\S+/g) || []).join(' ');
	        });
	        if (theme !== 'default') $('body').addClass(theme);
        </script>
	<?php include('header.php'); ?>
	<section class="wrapper scrollable">
		<nav class="user-menu">
			<a href="javascript:;" class="main-menu-access">
			<i class="icon-proton-logo"></i>
			<i class="icon-reorder"></i>
			</a>
		</nav>
		<?php include("topMenu.php");?>
		<div class="main-grid">
			
		
			
			<div class="agile-grids">
			
				<div class="col-md-12s chart-left">
					<!-- updating-data -->
					<div class="agile-Updating-grids">
						
							<div class="w3l-table-info">

					 <h3>Suicide Data</h3> <br> <a href="#" class="btn btn-hover btn-dark btn-block" style="width: 29%;" data-toggle="modal" data-target="#contactsModal">Add Suicdie Data
					 	</a>
					    <table id="table"> 
						<thead>
						  <tr>
							<th>Month</th>
							<th>Number</th>
							<th>Gender</th>
							<th>Action</th>
							
							
						  </tr>
						</thead>
						<tbody>
							<?php
                                            
                            while($a = mysqli_fetch_array($con))
                            { ?>
						  <tr>
							<td><?php echo $a['month'];?></td>
							
							<td class="MyClass"><?php echo $a['number'];?></td>
							<td><?php echo $a['gender'];?></td>
						
							<td><a href="deleteSuicideData.php?id=<?php echo $a['id'];?>">Delete</a></td>
						
							
						  </tr>
						 <?php } ?>
						</tbody>
					  </table>
					</div>
				  <code class="js">
					
				  </code>
						

					</div>
					<!-- //updating-data -->
				</div>
				<div class="clearfix"> </div>
			</div>
			
	
	
		</div>
		<!-- footer -->
	<?php include('footer.php'); ?>
		<!-- //footer -->
	</section>
	<script src="js/bootstrap.js"></script>
	<script src="js/proton.js"></script>

	<div class="modal fade" id="contactsModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Add Contact</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        <form method="POST" action="" class="valida" autocomplete="off" novalidate="novalidate">

										

										<label for="field-1-1">Month: (required)&nbsp;<span class="at-required-highlight">*</span></label>
										<div class="form-group">
											<select name="month" id="field-2" required="true" class="form-control">
												<option value="January">January</option>
												<option value="February">February</option>
												<option value="March">March</option>
												<option value="April">April</option>
												<option value="May">May</option>
												<option value="June">June</option>
												<option value="July">July</option>
												<option value="August">August</option>
												<option value="September">September</option>
												<option value="October">October</option>
												<option value="November">November</option>
												<option value="December">December</option>
												
												<!-- <option value="Gandaki">Gandaki</option>
												<option value="Province 5">Province 5</option>
												<option value="Karnali">Karnali</option>
												<option value="Sudur Paschim">Sudur Paschim</option> -->
											</select>
										</div>
										<div class="row">

											

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

												<label for="field-1-2">Number of Cases: (required)</label>
												<div class="form-group">
													<input type="number" name="number" id="field-1-4-2"  class="form-control" required="true">
												</div>

											</div>

										</div>

										

										<hr>

                                         	<label for="field-2">Gender: (required)&nbsp;<span class="at-required-highlight">*</span></label>
										<div class="form-group">
											<select name="gender" id="field-2" required="true" class="form-control">
												<option value="">Choose One</option>
												<option value="Male">Male</option>
												<option value="Female">Female</option>
												<option value="Others">Others</option>
												<!-- <option value="Gandaki">Gandaki</option>
												<option value="Province 5">Province 5</option>
												<option value="Karnali">Karnali</option>
												<option value="Sudur Paschim">Sudur Paschim</option> -->
											</select>
										</div>
										<!-- <label for="field-2">Sector: (required)&nbsp;<span class="at-required-highlight">*</span></label>
										<div class="form-group">
											<select name="province" id="field-2" required="true" class="form-control">
												<option value="">Choose One</option>
												<option value="Province 1">Province 1</option>
												<option value="Province 2">Province 2</option>
												<option value="Bagmati">Bagmati</option>
												<option value="Gandaki">Gandaki</option>
												<option value="Province 5">Province 5</option>
												<option value="Karnali">Karnali</option>
												<option value="Sudur Paschim">Sudur Paschim</option>
											</select>
										</div> -->

										<hr>

										

										

										<p>
											<input type="submit" name="saveContact" value="Submit" class="btn btn-primary">
											<input type="reset" name="res-1" id="res-1" value="Reset" class="btn btn-danger">
											
										</p>
									</form>
      </div>
      
    </div>
  </div>
</div>
<script type="text/javascript" src="js/valida.2.1.6.min.js"></script>
		<script type="text/javascript" >

			$(document).ready(function() {

				// show Valida's version.
				$('#version').valida( 'version' );

				// Exemple 1
				$('.valida').valida();

				// Exemple 2
				/*
				$('.valida').valida({

					// basic settings
					validate: 'novalidate',
					autocomplete: 'off',
					tag: 'p',

					// default messages
					messages: {
						submit: 'Wait ...',
						required: 'Este campo é obrigatório',
						invalid: 'Field with invalid data',
						textarea_help: 'Digitados <span class="at-counter">{0}</span> de {1}'
					},

					// filters & callbacks
					use_filter: true,

					// a callback function that will be called right before valida runs.
					// it must return a boolan value (true for good results and false for errors)
					before_validate: null,

					// a callback function that will be called right after valida runs.
					// it must return a boolan value (true for good results and false for errors)
					after_validate: null

				});
				*/

        // setup the partial validation
				$('#partial-1').on('click', function( ev ) {
					ev.preventDefault();
					$('#res-1').click(); // clear form error msgs
					$('form').valida('partial', '#field-1'); // validate only field-1
					//$('form').valida('partial', '#field-1-3'); // validate only field-1-3
				});

			});

		</script>
</body>
</html>
