<?php
include("includes/connect.php");
//echo encode5t("admin");
//exit;

if(isset($_POST['update_btn2']))
	
	
{
	
	//$title=mysqli_real_escape_string($con,$_POST['title']);
	$state=mysqli_real_escape_string($con,$_POST['state']);
	$country=mysqli_real_escape_string($con,$_POST['country']);

	
	 $sql = "INSERT INTO tbl_state (country_id,state)VALUES ('".$country."','".$state."')";
		mysqli_query($con, $sql);
		header("Location:state.php");
	
		$con->close();

}
?>

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta name="description" content="Vali is a responsive and free admin theme built with Bootstrap 4, SASS and PUG.js. It's fully customizable and modular.">
    <!-- Twitter meta-->
    <meta property="twitter:card" content="summary_large_image">
    <meta property="twitter:site" content="@pratikborsadiya">
    <meta property="twitter:creator" content="@pratikborsadiya">
    <!-- Open Graph Meta-->
    <!--<meta property="og:type" content="website">
    <meta property="og:site_name" content="Vali Admin">
    <meta property="og:title" content="Vali - Free Bootstrap 4 admin theme">
    <meta property="og:url" content="http://pratikborsadiya.in/blog/vali-admin">
    <meta property="og:image" content="http://pratikborsadiya.in/blog/vali-admin/hero-social.png">
    <meta property="og:description" content="Vali is a responsive and free admin theme built with Bootstrap 4, SASS and PUG.js. It's fully customizable and modular.">
    <title>Asianet Admin</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- Main CSS-->
    <link rel="stylesheet" type="text/css" href="css/main.css">
    <!-- Font-icon css-->
    <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
  </head>
  <body class="app sidebar-mini">
    <!-- Navbar-->
    <header class="app-header"><a class="app-header__logo" href="index.html"><img src="images/asianetweb.png" height="50px"></a>
    <!-- Sidebar toggle button--><a class="app-sidebar__toggle" href="#" data-toggle="sidebar" aria-label="Hide Sidebar"></a>
    <!-- Navbar Right Menu-->
    <ul class="app-nav">
      <!--Notification Menu-->
      <!--<li class="dropdown"><a class="app-nav__item" href="#" data-toggle="dropdown" aria-label="Show notifications"><i class="fa fa-bell-o fa-lg"></i></a>
      <ul class="app-notification dropdown-menu dropdown-menu-right">
        <li class="app-notification__title">You have 4 new notifications.</li>
        <div class="app-notification__content">
          <li><a class="app-notification__item" href="javascript:;"><span class="app-notification__icon"><span class="fa-stack fa-lg"><i class="fa fa-circle fa-stack-2x text-primary"></i><i class="fa fa-envelope fa-stack-1x fa-inverse"></i></span></span>
          <div>
            <p class="app-notification__message">Lisa sent you a mail</p>
            <p class="app-notification__meta">2 min ago</p>
          </div></a></li>
          <li><a class="app-notification__item" href="javascript:;"><span class="app-notification__icon"><span class="fa-stack fa-lg"><i class="fa fa-circle fa-stack-2x text-danger"></i><i class="fa fa-hdd-o fa-stack-1x fa-inverse"></i></span></span>
          <div>
            <p class="app-notification__message">Mail server not working</p>
            <p class="app-notification__meta">5 min ago</p>
          </div></a></li>
          <li><a class="app-notification__item" href="javascript:;"><span class="app-notification__icon"><span class="fa-stack fa-lg"><i class="fa fa-circle fa-stack-2x text-success"></i><i class="fa fa-money fa-stack-1x fa-inverse"></i></span></span>
          <div>
            <p class="app-notification__message">Transaction complete</p>
            <p class="app-notification__meta">2 days ago</p>
          </div></a></li>
          <div class="app-notification__content">
            <li><a class="app-notification__item" href="javascript:;"><span class="app-notification__icon"><span class="fa-stack fa-lg"><i class="fa fa-circle fa-stack-2x text-primary"></i><i class="fa fa-envelope fa-stack-1x fa-inverse"></i></span></span>
            <div>
              <p class="app-notification__message">Lisa sent you a mail</p>
              <p class="app-notification__meta">2 min ago</p>
            </div></a></li>
            <li><a class="app-notification__item" href="javascript:;"><span class="app-notification__icon"><span class="fa-stack fa-lg"><i class="fa fa-circle fa-stack-2x text-danger"></i><i class="fa fa-hdd-o fa-stack-1x fa-inverse"></i></span></span>
            <div>
              <p class="app-notification__message">Mail server not working</p>
              <p class="app-notification__meta">5 min ago</p>
            </div></a></li>
            <li><a class="app-notification__item" href="javascript:;"><span class="app-notification__icon"><span class="fa-stack fa-lg"><i class="fa fa-circle fa-stack-2x text-success"></i><i class="fa fa-money fa-stack-1x fa-inverse"></i></span></span>
            <div>
              <p class="app-notification__message">Transaction complete</p>
              <p class="app-notification__meta">2 days ago</p>
            </div></a></li>
          </div>
        </div>
        <li class="app-notification__footer"><a href="#">See all notifications.</a></li>
      </ul>
    </li>-->
    <!-- User Menu-->
    <li class="dropdown"><a class="app-nav__item" href="#" data-toggle="dropdown" aria-label="Open Profile Menu"><i class="fa fa-user fa-lg"></i></a>
    <ul class="dropdown-menu settings-menu dropdown-menu-right">
      <li><a class="dropdown-item" href="page-user.html"><i class="fa fa-cog fa-lg"></i> Settings</a></li>
      <li><a class="dropdown-item" href="page-user.html"><i class="fa fa-user fa-lg"></i> Profile</a></li>
      <li><a class="dropdown-item" href="page-login.html"><i class="fa fa-sign-out fa-lg"></i> Logout</a></li>
    </ul>
  </li>
</ul>
</header>
<!-- Sidebar menu-->
<div class="app-sidebar__overlay" data-toggle="sidebar"></div>

	   <?php include 'includes/side_bar.php';?>
<main class="app-content">
<div class="app-title">
  <div>
    <h1><i class="fa fa-th-list"></i> Tax</h1>
  </div>
  <ul class="app-breadcrumb breadcrumb">
    <li class="breadcrumb-item"><i class="fa fa-home fa-lg"></i></li>
    <li class="breadcrumb-item">uers list</li>
    <li class="breadcrumb-item active"><a href="#">Home</a></li>
  </ul>
</div>
<div class="row">
  
  <div class="col-md-12">
    <div class="col-md-8">
      <div class="tile">
        <h3 class="tile-title">State</h3>
        <div class="tile-body">
          <form name="frm" method="post" action="">
            <div class="form-group">
              <label class="control-label">State</label>
              <input class="form-control" name="state" type="text" placeholder="title">
            </div>
            <div class="form-group">
              <label class="control-label">Country </label>
              <select name="country" id="" class="form-control">
                <?php 
                
                $sql=mysqli_query($con,"select * from tbl_country");
                while($row=mysqli_fetch_array($sql))
                {
                  ?>
                  <option value="<?php echo $row['id'];?>"><?php echo $row['country'];?></option>
                  <?php
                }
                ?>
                
              </select>
            </div>
            
			          <div class="tile-footer">
          <button class="btn btn-primary" type="submit" name="update_btn2"><i class="fa fa-fw fa-lg fa-check-circle"></i>Add Now</button>&nbsp;&nbsp;&nbsp;<a class="btn btn-secondary" href="#"><i class="fa fa-fw fa-lg fa-times-circle"></i>Cancel</a>
        </div>
          </form>

          
        </div>


        <table class="table mt-5">
            <thead>
              <tr>
                <th scope="col">#</th>
                <th scope="col">Country</th>
                
                <th scope="col">State</th>
              </tr>
            </thead>
            <tbody>
				<?php
						$m="select * from tbl_state order by id desc";
						$count=1;
						$result = $con->query($m);
						while($row = mysqli_fetch_array($result,MYSQLI_BOTH))
						{
              $cou=mysqli_fetch_array(mysqli_query($con,"select * from tbl_country where id='".$row['country_id']."'"))
						?>
				
              <tr>
                <th scope="row"><?php echo $count;?></th>
                <td><?php echo $cou['country'];?></td>
                
                <td><?php echo $row['state_name'];?></td>
              </tr>
				
				<?php
						$count++;
						}
						?>  
            </tbody>
          </table>
      </div>
    </div>
  </div>
</div>
</main>
<!-- Essential javascripts for application to work-->
<script src="js/jquery-3.3.1.min.js"></script>
<script src="js/popper.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/main.js"></script>
<!-- The javascript plugin to display page loading on top-->
<script src="js/plugins/pace.min.js"></script>
<!-- Page specific javascripts-->
<!-- Google analytics script-->
<script type="text/javascript">
if(document.location.hostname == 'pratikborsadiya.in') {
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-72504830-1', 'auto');
ga('send', 'pageview');
}
</script>
</body>
</html>