D:\host\scoreman.in\kleague2026\SearchApplicationsbackup.php

<?php
include('dbconnect.php');
include('jfunctions.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />

<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css" />
		<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jquerymobile/1.4.5/jquery.mobile.min.css" />
		<link rel="stylesheet" href="vendor/waves/waves.min.css" />
		<link rel="stylesheet" href="css/nativedroid2.css" />
        <link rel="stylesheet" href="css/cbstyle.css" />
      	<link rel="stylesheet" href="vendor/wow/animate.css" />


<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
		<script src="//code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
		<script src="//ajax.googleapis.com/ajax/libs/jquerymobile/1.4.5/jquery.mobile.min.js"></script>
		<script src="vendor/waves/waves.min.js"></script>
        
        <script src="vendor/wow/wow.min.js"></script> 
		<script src="js/nativedroid2.js"></script>
		<script src="nd2settings.js"></script>
        		<script src="js/cropbox-min.js"></script> 
           

		 <script>
function setraces() {
	var radioValue = $("input[name='skatertype']:checked").val();
	if(radioValue=="Speed-Quad"){
               $('#sqraces').show();
			   $('#siraces').hide();
			   $('#u8qraces').hide();
			   $('#tenraces').hide();
            }
				if(radioValue=="Speed-Inline"){
               $('#sqraces').hide();
			   $('#siraces').show();
			   $('#u8qraces').hide();
			   $('#tenraces').hide();
            }
				if(radioValue=="Under8-Quad"){
               $('#sqraces').hide();
			   $('#siraces').hide();
			   $('#u8qraces').show();
			   $('#tenraces').hide();
            }
				if(radioValue=="Tenacity"){
               $('#sqraces').hide();
			   $('#siraces').hide();
			   $('#u8qraces').hide();
			   $('#tenraces').show();
            }
	

$('#rink1').attr("checked",false).checkboxradio("refresh");
$('#rink2').attr("checked",false).checkboxradio("refresh");
$('#rink3').attr("checked",false).checkboxradio("refresh");
$('#road1').attr("checked",false).checkboxradio("refresh");

$('#rink4').attr("checked",false).checkboxradio("refresh");
$('#rink5').attr("checked",false).checkboxradio("refresh");
$('#rink6').attr("checked",false).checkboxradio("refresh");
$('#road2').attr("checked",false).checkboxradio("refresh");
$('#p2p').attr("checked",false).checkboxradio("refresh");
$('#elim').attr("checked",false).checkboxradio("refresh");
$('#elimrd').attr("checked",false).checkboxradio("refresh");
$('#relay').attr("checked",false).checkboxradio("refresh");
$('#marathon').attr("checked",false).checkboxradio("refresh");
$('#race100').attr("checked",false).checkboxradio("refresh");

$('#u8race1').attr("checked",false).checkboxradio("refresh");
$('#u8race2').attr("checked",false).checkboxradio("refresh");

$('#tenrace1').attr("checked",false).checkboxradio("refresh");
$('#tenrace2').attr("checked",false).checkboxradio("refresh");

}
  
  
  
  </script>
  
  <script type="text/javascript">
    $(window).load(function() {
        var options =
        {
            thumbBox: '.thumbBox',
            spinner: '.spinner',
            imgSrc: 'avatar.png'
        }
        var cropper;
        $('#file').on('change', function(){
//$("#cropup").popup("open");
alert("hi");
            var reader = new FileReader();
            reader.onload = function(e) {
                options.imgSrc = e.target.result;
                cropper = $('.imageBox').cropbox(options);
            }
            reader.readAsDataURL(this.files[0]);
            this.files = [];
        })
        $('#btnCrop').on('click', function(){
            var img = cropper.getDataURL()
            $('.cropped').append('<img src="'+img+'">');
			//$("#cropup").popup("close");
        })
        $('#btnZoomIn').on('click', function(){
            cropper.zoomIn();
        })
        $('#btnZoomOut').on('click', function(){
            cropper.zoomOut();
        })
    });
	
	/**
 * Created by ezgoing on 14/9/2014.
 */

"use strict";
(function (factory) {
    if (typeof define === 'function' && define.amd) {
        define(['jquery'], factory);
    } else {
        factory(jQuery);
    }
}(function ($) {
    var cropbox = function(options, el){
        var el = el || $(options.imageBox),
            obj =
            {
                state : {},
                ratio : 1,
                options : options,
                imageBox : el,
                thumbBox : el.find(options.thumbBox),
                spinner : el.find(options.spinner),
                image : new Image(),
                getDataURL: function ()
                {
                    var width = this.thumbBox.width(),
                        height = this.thumbBox.height(),
                        canvas = document.createElement("canvas"),
                        dim = el.css('background-position').split(' '),
                        size = el.css('background-size').split(' '),
                        dx = parseInt(dim[0]) - el.width()/2 + width/2,
                        dy = parseInt(dim[1]) - el.height()/2 + height/2,
                        dw = parseInt(size[0]),
                        dh = parseInt(size[1]),
                        sh = parseInt(this.image.height),
                        sw = parseInt(this.image.width);

                    canvas.width = width;
                    canvas.height = height;
                    var context = canvas.getContext("2d");
                    context.drawImage(this.image, 0, 0, sw, sh, dx, dy, dw, dh);
                    var imageData = canvas.toDataURL('image/png');
                    return imageData;
                },
                getBlob: function()
                {
                    var imageData = this.getDataURL();
                    var b64 = imageData.replace('data:image/png;base64,','');
                    var binary = atob(b64);
                    var array = [];
                    for (var i = 0; i < binary.length; i++) {
                        array.push(binary.charCodeAt(i));
                    }
                    return  new Blob([new Uint8Array(array)], {type: 'image/png'});
                },
                zoomIn: function ()
                {
                    this.ratio*=1.1;
                    setBackground();
                },
                zoomOut: function ()
                {
                    this.ratio*=0.9;
                    setBackground();
                }
            },
            setBackground = function()
            {
                var w =  parseInt(obj.image.width)*obj.ratio;
                var h =  parseInt(obj.image.height)*obj.ratio;

                var pw = (el.width() - w) / 2;
                var ph = (el.height() - h) / 2;

                el.css({
                    'background-image': 'url(' + obj.image.src + ')',
                    'background-size': w +'px ' + h + 'px',
                    'background-position': pw + 'px ' + ph + 'px',
                    'background-repeat': 'no-repeat'});
            },
            imgMouseDown = function(e)
            {
                e.stopImmediatePropagation();

                obj.state.dragable = true;
                obj.state.mouseX = e.clientX;
                obj.state.mouseY = e.clientY;
            },
            imgMouseMove = function(e)
            {
                e.stopImmediatePropagation();

                if (obj.state.dragable)
                {
                    var x = e.clientX - obj.state.mouseX;
                    var y = e.clientY - obj.state.mouseY;

                    var bg = el.css('background-position').split(' ');

                    var bgX = x + parseInt(bg[0]);
                    var bgY = y + parseInt(bg[1]);

                    el.css('background-position', bgX +'px ' + bgY + 'px');

                    obj.state.mouseX = e.clientX;
                    obj.state.mouseY = e.clientY;
                }
            },
            imgMouseUp = function(e)
            {
                e.stopImmediatePropagation();
                obj.state.dragable = false;
            },
            zoomImage = function(e)
            {
                e.originalEvent.wheelDelta > 0 || e.originalEvent.detail < 0 ? obj.ratio*=1.1 : obj.ratio*=0.9;
                setBackground();
            }

        obj.spinner.show();
        obj.image.onload = function() {
            obj.spinner.hide();
            setBackground();

            el.bind('mousedown', imgMouseDown);
            el.bind('mousemove', imgMouseMove);
            $(window).bind('mouseup', imgMouseUp);
            el.bind('mousewheel DOMMouseScroll', zoomImage);
        };
        obj.image.src = options.imgSrc;
        el.on('remove', function(){$(window).unbind('mouseup', imgMouseUp)});

        return obj;
    };

    jQuery.fn.cropbox = function(options){
        return new cropbox(options, this);
    };
}));



</script>

</body>
</html>

<title>Search Result</title>

<style>
        .container
        {
           /*position: relative;*/
           
        }
        .action
        {
           /* width: 400px;
            height: 30px;
           margin: 1px 0;*/
        }
        .cropped>img
        {
            margin-right: 10px;
        }
    </style>
    
<style>
@media print
{    
    .no-print, .no-print *
    {
        display: none !important;
    }
	
	table
{
font-size:10px;
max-width:60%;
}

}



/*table, th, td {
    border: 1px solid black;
}


table
{
	font-family:Verdana, Geneva, sans-serif;
    border-collapse: collapse;
}
			th
			{
				background-color:#EBEBEB;
				color:#00F;
				text-align: center;
				vertical-align: bottom;
				height: 100px;
				padding-bottom: 3px;
				padding-left: 0px;
			padding-right: 0px;
			
			}
			td{
				text-align:center;
padding-bottom: 3px;
padding-top: 3px;
			} */
			tr:nth-child(even) {
    background-color:#F1F1F8;
}

table
{
font-size:11px;
max-width:90%;
}
table, th, td {
    border: 1px solid #ccc;
}



	th{
text-align: center;
				vertical-align: middle;
				height: 110px;
				padding-bottom: 3px;
				padding-left: 0px;
			padding-right: 0px;
				
			
background-color:#E6E6E6;

	}
   


			.verticalText
			{
				/*font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;*/
				font-size:11px;
				text-align: left;
				vertical-align: bottom;
				width: 20px;
				margin:0px;
				margin-top:60px;
				padding: 0px;
				padding-left: 0px;
				padding-right: 0px;
				padding-top: 0px;
				
			
				white-space: nowrap;
				-webkit-transform: rotate(-90deg); 
				-moz-transform: rotate(-90deg);  				
			};
		</style>
       <h2></h2>
</head>

<body>
<div data-role="page">
  <div data-role="header">
    <h1>32nd STATE ROLLER SKATING CHAMPIONSHIP & SELECTION TRIALS - 2016</h1>
  </div>
<div data-role="main" class="ui-content">

<?php

//if ($_SERVER['REQUEST_METHOD'] == 'POST')
//{
	
	//$skey=$_POST["skey"];
	//$club=$_POST["club"];
	$club=$_SESSION["username"];
	
	if($club =="secretary")
	{
		echo "Team Wise Entries <br/><table border=1>";
		$databaseQuery = 'SELECT club,count(*) as c FROM applications group by club';
	$result = mysqli_query($con,$databaseQuery) or die('Query failed: ' . mysqli_error());
	while($row = mysqli_fetch_array($result))
  {
	   echo "<tr><td>".$row["club"]."</td><td>".$row["c"]."</td><td class='no-print'><a  href='SearchApplications.php?team=".$row["club"]."&stype=all'>View List</a></td></tr>";
  }
  echo "</table>";
  
  echo "Summary <br/><table border=1>";
		$databaseQuery = 'SELECT  status,count(appno) as c FROM applications group by status order by c desc';
	$result = mysqli_query($con,$databaseQuery) or die('Query failed: ' . mysqli_error());
	while($row = mysqli_fetch_array($result))
  {
	  if($row["status"]!="")
	  {
	   echo "<tr><td>".$row["status"]."</td><td>".$row["c"]."</td></tr>";
	  }
	  else
	  {
		  	   echo "<tr><td>Unverified</td><td>".$row["c"]."</td></tr>";
		  }
  }
  echo "</table>";
echo "Participation Summary <br/><table border=1>";
		$databaseQuery = 'SELECT  skatertype,count(appno) as c FROM applications group by skatertype order by c desc';
	$result = mysqli_query($con,$databaseQuery) or die('Query failed: ' . mysqli_error());
	while($row = mysqli_fetch_array($result))
  {
	  if($row["skatertype"]!="")
	  {
	   echo "<tr><td>".$row["skatertype"]."</td><td>".$row["c"]."</td></tr>";
	  }
	  else
	  {
		  	   echo "<tr><td>Unverified</td><td>".$row["c"]."</td></tr>";
		  }
  }
  echo "</table>";
	
	
	
	if ($_SERVER['REQUEST_METHOD'] == 'GET')
{
	$club=$_GET['team'];
	$skey=$_GET['team'];
	$stype=$_GET['stype'];
	if($stype=="" || $stype=="all")
	{
		$stype="%";
		}
	
	$databaseQuery = 'SELECT * FROM applications WHERE (skatertype like "%'.$stype.'%") and (club like "%'.$con->real_escape_string($club).'%")  order by agorder,gender desc,skatertype,CONVERT(appno,UNSIGNED INTEGER)';
	
	$result2 = mysqli_query($con,$databaseQuery) or die('Query failed: ' . mysqli_error());
	$skey=$club;
	
	 echo "Summary for ".$club."<br/><table border=1>";
		$databaseQuery = 'SELECT  status,count(appno) as c FROM applications  WHERE (club like "%'.$con->real_escape_string($club).'%")  group by status order by c desc';
	$result = mysqli_query($con,$databaseQuery) or die('Query failed: ' . mysqli_error());
	while($row = mysqli_fetch_array($result))
  {
	  if($row["status"]!="")
	  {
	   echo "<tr><td>".$row["status"]."</td><td>".$row["c"]."</td></tr>";
	  }
	  else
	  {
		  	   echo "<tr><td>Unverified</td><td>".$row["c"]."</td></tr>";
		  }
  }
  echo "</table>";
  
  
}
else
{
	
	$databaseQuery = 'SELECT * FROM applications WHERE (skatertype like "%'.$stype.'%")  order by agorder,gender desc,skatertype,CONVERT(appno,UNSIGNED INTEGER) ';
	$result = mysqli_query($con,$databaseQuery) or die('Query failed: ' . mysqli_error());
	
	$skey="All Applications";
	$stype="%";
}
	}
	else if($club !="")
	{
		$stype="%";
		if ($_SERVER['REQUEST_METHOD'] == 'GET')
{
	//$club=$_GET['team'];
//	$skey=$_GET['team'];
	$stype=$_GET['stype'];
	if($stype=="" || $stype=="all")
	{
		$stype="%";
		}
}
	
	$databaseQuery = 'SELECT * FROM applications WHERE (skatertype like "%'.$stype.'%") and (club like "%'.$con->real_escape_string($club).'%")  order by agorder,gender desc,skatertype,CONVERT(appno,UNSIGNED INTEGER)';

	$result2 = mysqli_query($con,$databaseQuery) or die('Query failed: ' . mysqli_error());
	$skey=$club;
	}
	else
	{
		echo 'Please Enter Correct Login Credentials..';
						 loginbox();
						 exit();
		}
		if (function_exists('date_default_timezone_set'))
{
 date_default_timezone_set('Asia/Calcutta');
}
if($stype=="%")
	{
		$stype="all";
		}
		echo '<p class="font2"> ' .mysqli_num_rows($result2) . ' Results found for "'.$club.'", "'.$stype.'" as on '.date('d-m-Y  h:i:s A').'.</p>';
		echo '<h3 class="no-print">Filters: <a href="SearchApplications.php?team='.$club.'&stype=all">All</a>&nbsp;&nbsp;|&nbsp;&nbsp;';
	echo '<a href="SearchApplications.php?team='.$club.'&stype=Adjustable">Tenacity</a>&nbsp;&nbsp;|&nbsp;&nbsp;';
		echo '<a href="SearchApplications.php?team='.$club.'&stype=Speed-Quad">Speed-Quad</a>&nbsp;&nbsp;|&nbsp;&nbsp;';
				echo '<a href="SearchApplications.php?team='.$club.'&stype=Speed-Inline">Speed-Inline</a>&nbsp;&nbsp;|&nbsp;&nbsp;';
				
			echo '<a href="SearchApplications.php?team='.$club.'&stype=Artistic">Artistic</a>&nbsp;&nbsp;|&nbsp;&nbsp;';
				echo '<a href="SearchApplications.php?team='.$club.'&stype=Hockey">Hockey</a>&nbsp;&nbsp;|&nbsp;&nbsp;';
					echo '<a href="SearchApplications.php?team='.$club.'&stype=Freestyle">Freestyle</a>&nbsp;&nbsp; <br/><br/>
					<a href="javascript:window.print()">PRINT</a></h3>';
if($result2)
{
	//id="example"
?>
<div data-role="popup" id="cropup" class="ui-content" data-position-to="window"   >
 <div data-role="header">
		<h1 class='nd-title'>Crop Photo</h1>
	</div>
    <div data-role="content">
   <div class="container">
    <div class="imageBox">
        <div class="thumbBox"></div>
        <div class="spinner" style="display: none">Loading...</div>
    </div>
    <div class="action">
     
        
        
        <input type="button" id="btnCrop" value="Crop" class="ui-btn">
        <input type="button" id="btnZoomIn" value="+"  class="ui-btn">
        <input type="button" id="btnZoomOut" value="-"  class="ui-btn">
        
        
    </div>
   
    
    </div>

					</div>
</div>


    </div>
    
    </div>

 <div data-role="popup" id="myPopup" class="ui-content"  >
<!--<div data-role="panel" id="myPopup" data-display="overlay" data-position-fixed="true" class="ui-panel ui-panel-position-left" style="min-width:550px; float:right;">  -->

<!-- <div  id="myPopup" class="ui-content" style="display:none;" >-->
 <div data-role="header">
		<h1 class='nd-title'>Edit Form</h1>
	</div>
	<div data-role="content">
   

    
    <div class="nd2-no-menu-swipe">

			
			<div  class="ui-content wow fadeIn" data-inset="false" data-wow-delay="0.2s">


				<form>


				 <div class="row">

		<div class="col-xs-12 col-sm-6 col-md-4">

       				<div class="box">

						<label for="name2b">Name:</label>
                        <input type="text" name="name2" id="name2b" value="" data-clear-btn="true" placeholder="Type Skater Name here...">
                        <label for="inputDate">Date of Birth:</label>
                        <input type="date" name="inputDate" id="inputDate" value="" data-clear-btn="true" placeholder="">
                         <label for="ag">Age Group:</label>
                          <input type="text" name="ag" id="ag" value="" data-clear-btn="true" placeholder="">
                          

					</div>
		</div>
        
        <div class="col-xs-12 col-sm-6 col-md-4">
<div class="box">
<fieldset data-role="controlgroup" data-type="horizontal" data-mini="true">
                            <legend>Category</legend>
                            <input type="radio" name="skatertype" id="skatertype1" value="Speed-Quad"  onchange="setraces();">
                            <label for="skatertype1">Speed-Quad</label>
                            <input type="radio" name="skatertype" id="skatertype2" value="Speed-Inline"  onchange="setraces();">
                            <label for="skatertype2">Speed-Inline</label>
                            <input type="radio" name="skatertype" id="skatertype3" value="Under8-Quad"  onchange="setraces();">
                            <label for="skatertype3">Under8-Quad</label>
                            <input type="radio" name="skatertype" id="skatertype4" value="Tenacity"  onchange="setraces();">
                            <label for="skatertype4">Tenacity</label>
                        </fieldset>

						
<div id="sqraces" style="display:none;">
	<fieldset data-role="controlgroup">
  <legend>Speed-Quad Events</legend>
  <input type="checkbox" name="rink1" id="rink1">
  <label for="rink1">Rink - I</label>
   <input type="checkbox" name="rink2" id="rink2">
  <label for="rink2">Rink - II</label>
   <input type="checkbox" name="rink3" id="rink3">
  <label for="rink3">Rink - III</label>
   <input type="checkbox" name="road1" id="road1">
  <label for="road1">Road - I</label>

</fieldset>
</div>
<div id="siraces" style="display:none;">
	<fieldset data-role="controlgroup">
  <legend>Speed-Inline Events</legend>
  <input type="checkbox" name="rink4" id="rink4">
  <label for="rink4">Rink - IV</label>
   <input type="checkbox" name="rink5" id="rink5">
  <label for="rink5">Rink - V</label>
   <input type="checkbox" name="rink6" id="rink6">
  <label for="rink6">Rink - VI</label>
   <input type="checkbox" name="road2" id="road2">
  <label for="road2">Road - II</label>
   <input type="checkbox" name="p2p" id="p2p">
  <label for="p2p">Point to Point</label>
    
       <input type="checkbox" name="elim" id="elim">
  <label for="elim">Elimination - Rink</label>
    <input type="checkbox" name="elimrd" id="elimrd">
  <label for="elimrd">Elimination - Road</label>
  
    <input type="checkbox" name="relay" id="relay">
  <label for="relay">Relay</label>
    <input type="checkbox" name="marathon" id="marathon">
  <label for="marathon">Marathon</label>
    <input type="checkbox" name="race100" id="race100">
  <label for="race100">100mtr Race</label>
  

</fieldset>
</div>
<div id="u8qraces" style="display:none;">
	<fieldset data-role="controlgroup">
  <legend>Under8-Quad Events</legend>
  <input type="checkbox" name="u8race1" id="u8race1" >
  <label for="u8race1">Race - I</label>
   <input type="checkbox" name="u8race2" id="u8race2">
  <label for="u8race2">Race - II</label>
  

</fieldset>
</div>
<div id="tenraces" style="display:none;">
	<fieldset data-role="controlgroup">
  <legend>Tenacity Events</legend>
  <input type="checkbox" name="tenrace1" id="tenrace1">
  <label for="tenrace1">Race - I</label>
   <input type="checkbox" name="tenrace2" id="tenrace2">
  <label for="tenrace2">Race - II</label>
   
</fieldset>
</div>


                          

					</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-4">
<div class="box">

						<label for="phone">Phone:</label>
                        <input type="text" name="phone" id="phone" value="" data-clear-btn="true" placeholder="">
                                           <label for="club">Club Name:</label>
                          <input type="text" name="club" id="club" value="" data-clear-btn="true" placeholder="">
                            <label for="club">Fathername & Address:</label>
                          <input type="text" name="address" id="address" value="" data-clear-btn="true" placeholder="">
                           <label for="club">Blood Group</label>
                          <input type="text" name="blood" id="blood" value="" data-clear-btn="true" placeholder="">
                          <label for="file">Photo</label>
                          <input type="file" name="file" id="file">
                           <div class="cropped">   </div>
                           
                            <div class="container">
    <div class="imageBox">
        <div class="thumbBox"></div>
        <div class="spinner" style="display: none">Loading...</div>
    </div>
    <div class="action">
     
        
        
        <input type="button" id="btnCrop" value="Crop" class="ui-btn">
        <input type="button" id="btnZoomIn" value="+"  class="ui-btn">
        <input type="button" id="btnZoomOut" value="-"  class="ui-btn">
        
        
    </div>
   
    
    </div>

					</div>
</div>
</div>				</form>


			</div>

		</div>
        
        
        
        
    
    
    
    
    </div>

	    </div>
		
<table data-role="table"    class="ui-responsive table-stroke">
<thead><tr><th><div class="verticalText">AppNo</div></th>
<th><div>Status</div></th>
				 <!--<th><div>TNRSA_ID</div></th>-->
				<th><div>Skater Name</div></th>
                <th><div>Date_of_Birth</div></th>
                <th><div>Age</div></th>
                <th><div>AgeGroup</div></th>
                <th><div>Gender</div></th>
                <th><div>Team</div></th>
                <?php
                if($stype=="Adjustable" || $stype=="all" )
			{
                ?>
                <th><div class="verticalText">Tenacity-Race 1</div></th>
                <th><div class="verticalText">Tenacity-Race 2</div></th> 
             <!--   <th><div class="verticalText">Adj-Rink IIA</div></th> -->
              <?php
			}
                ?>
                
                 <?php
                if($stype=="Speed-Quad"|| $stype=="all" )
			{
                ?>
               <th><div class="verticalText">Rink I</div></th>
                <th><div class="verticalText">Rink II</div></th>
                <th><div class="verticalText">Rink III</div></th>
                <th><div class="verticalText">Road I</div></th>
                                 
                   <?php
			}
                ?>
                 <?php
                if($stype=="Speed-Inline"|| $stype=="all" )
			{
                ?>
              
                <th><div class="verticalText">Rink IV</div></th>
                <th><div class="verticalText">Rink V</div></th>
                <th><div class="verticalText">Rink VI</div></th>
                <th><div class="verticalText">Road II</div></th>
                    <th><div class="verticalText">Point to Point</div></th>
                <th><div class="verticalText">Elim (Rink)</div></th>
                                <th><div class="verticalText">Elim (Road)</div></th>
         	        <th><div class="verticalText">Relay</div></th>
                 <th><div class="verticalText">Marathon</div></th> 
                 
                   <?php
			}
                ?>
                <?php
                if($stype=="Artistic" || $stype=="all" )
			{
                ?>
                    <th><div class="verticalText">Figure</div></th>
                <th><div class="verticalText">Free</div></th>
                <th><div class="verticalText">Combined</div></th>
                <th><div class="verticalText">Pair</div></th>
                <th><div class="verticalText">Inlinefree</div></th>
                <th><div class="verticalText">Solodance</div></th>
                <th><div class="verticalText">Pairdance</div></th>
                                <th><div class="verticalText">ShowSkating</div></th> 
                                 <?php
			}
                ?>
                                 <?php
                if($stype=="Hockey" || $stype=="all" )
			{
                ?>
                <th><div class="verticalText">Quadhockey</div></th>
                <th><div class="verticalText">Inlinehockey</div></th>
                
                   <?php
			}
                ?>
                 <?php
                if($stype=="Freestyle" || $stype=="all" )
			{
                ?>
                <th><div class="verticalText">Classic Slalom</div></th>
                <th><div class="verticalText">Speed Slalom</div></th> 
                <?php
			}
                ?>
                        <th><div class="verticalText">Comments</div></th>
                <th class="no-print"><div class="no-print">Edit Application</div></th>
           <!--    <th class="no-print"><div class="no-print">Reprint</div></th> -->
                </tr></thead>
<?php

//  id="example"  class="display"
$twocol=0;	
$itcount=0;
$curag="";
$curgender="";
	echo '<tbody>';
	while($row = mysqli_fetch_array($result2))
  {
	   $status=trim($row["status"]);
 $appno=trim($row["appno"]);
$sname=trim($row["sname"]);
$tnrsaid=trim($row["tnrsaid"]);
$dob=trim($row["dob"]);
$age=trim($row["age"]);
$ag=trim($row["agegroup"]);
$gender=trim($row["gender"]);
$club=trim($row["club"]);
$clubname=trim($row["clubname"]);
$fathername=trim($row["fathername"]);
$address=trim($row["address"]);
$city=trim($row["city"]);
$pin=trim($row["pin"]);
$phone=trim($row["phone"]);
$email=trim($row["email"]);
$blood=trim($row["bloodgroup"]);
$comments=trim($row["comments"]);
$photourl=trim($row["photourl"]);
$nodob="";
$doburl=trim($row["doburl"]);
if($doburl=='NA')
{
$nodob="true";
}
$adjrink1=trim($row["adjrink1"]);

if($adjrink1=='true')
{
	$adjrink1="P";
	}
	else
	{
		$adjrink1="-";
		}
		
$adjrink2=trim($row["adjrink2"]);

if($adjrink2=='true')
{
	$adjrink2="P";
	}
	else
	{
		$adjrink2="-";
	}
	
	$adjrink3=trim($row["adjrink3"]);

if($adjrink3=='true')
{
	$adjrink3="P";
	}
	else
	{
		$adjrink3="-";
		}
$rink1=trim($row["rink1"]);
	if($rink1=='true')
	{
		$rink1="P";
	}
		else
	{
		$rink1="-";
	}
$rink2=trim($row["rink2"]);
if($rink2=='true')
	{
		$rink2="P";
	}
		else
	{
		$rink2="-";
	}
$rink3=trim($row["rink3"]);
if($rink3=='true')
	{
		$rink3="P";
	}
		else
	{
		$rink3="-";
	}
$road1=trim($row["road1"]);
if($road1=='true')
	{
		$road1="P";
	}
		else
	{
		$road1="-";
	}

$rink4=trim($row["rink4"]);
if($rink4=='true')
	{
		$rink4="P";
	}
		else
	{
		$rink4="-";
	}
$rink5=trim($row["rink5"]);
if($rink5=='true')
	{
		$rink5="P";
	}
		else
	{
		$rink5="-";
	}
$rink6=trim($row["rink6"]);
if($rink6=='true')
	{
		$rink6="P";
	}
		else
	{
		$rink6="-";
	}
$road2=trim($row["road2"]);
if($road2=='true')
	{
		$road2="P";
	}
		else
	{
		$road2="-";
	}
$p2p=trim($row["p2p"]);
if($p2p=='true')
	{
		$p2p="P";
	}
		else
	{
		$p2p="-";
	}

$elim=trim($row["elim"]);
if($elim=='true')
	{
		$elim="P";
	}
		else
	{
		$elim="-";
	}
	$elimrd=trim($row["elimrd"]);
if($elimrd=='true')
	{
		$elimrd="P";
	}
		else
	{
		$elimrd="-";
	}
$relay=trim($row["relay"]);
if($relay=='true')
	{
		$relay="P";
	}
		else
	{
		$relay="-";
	}
	$marathon=trim($row["marathon"]);
if($marathon=='true')
	{
		$marathon="P";
	}
		else
	{
		$marathon="-";
	}

$figure=trim($row["figure"]);
if($figure=='true')
	{
		$figure="P";
	}
		else
	{
		$figure="-";
	}
$free=trim($row["free"]);
if($free=='true')
	{
		$free="P";
	}
		else
	{
		$free="-";
	}
$combined=trim($row["combined"]);
if($combined=='true')
	{
		$combined="P";
	}
		else
	{
		$combined="-";
	}
$pair=trim($row["pair"]);
if($pair=='true')
	{
		$pair="P";
	}
		else
	{
		$pair="-";
	}
$inlinefree=trim($row["inlinefree"]);
if($inlinefree=='true')
	{
		$inlinefree="P";
	}
		else
	{
		$inlinefree="-";
	}
$solodance=trim($row["solodance"]);
if($solodance=='true')
	{
		$solodance="P";
	}
		else
	{
		$solodance="-";
	}
$pairdance=trim($row["pairdance"]);
if($pairdance=='true')
	{
		$pairdance="P";
	}
		else
	{
		$pairdance="-";
	}
$showskating=trim($row["showskating"]);
if($showskating=='true')
	{
		$showskating="P";
	}
		else
	{
		$showskating="-";
	}

$quadhockey=trim($row["quadhockey"]);
if($quadhockey=='true')
	{
		$quadhockey="P";
	}
		else
	{
		$quadhockey="-";
	}
$inlinehockey=trim($row["inlinehockey"]);
if($inlinehockey=='true')
	{
		$inlinehockey="P";
	}
		else
	{
		$inlinehockey="-";
	}

$classicslalom=trim($row["classicslalom"]);
if($classicslalom=='true')
	{
		$classicslalom="P";
	}
		else
	{
		$classicslalom="-";
	}
$speedslalom=trim($row["speedslalom"]);
if($speedslalom=='true')
	{
		$speedslalom="P";
	}
		else
	{
		$speedslalom="-";
	}


$bgc="";
if($status=="Approved")
{
	$bgc="Lime";
	}
	if($status=="Verified By Dt")
{
	$bgc="LightGreen";
	}
	if($status=="Pending")
{
	$bgc="Red";
	}
	if($status=="Held")
{
	$bgc="Yellow";
	}
	if($status=="Delete")
{
	$bgc="LightGrey";
	}
	
	if($curag!=$ag ||$curgender!=$gender)
	{
	echo '<tr style="background-color:#e6ffe6;"><td colspan=8><h5><b>'.$ag.' '.$gender.'</b></h5></td></tr>';	
	$curag=$ag;
	$curgender=$gender;
	}
echo '<tr style="background-color:'.$bgc.'"><td>'.$appno.'</td><td>'.$status.'</td> <!--<td>'.$tnrsaid.'</td>--><td style="	text-align:left;">'.$sname.'<br/>'.$phone.'<br/>Club: '.$clubname.'</td><td>'.$dob.'</td><td>'.$age.'</td><td>'.$ag.'</td><td>'.$gender.'</td><td>'.$club.'</td>';

                if($stype=="Adjustable" || $stype=="all" )
			{
                echo '<td>'.$adjrink1.'</td><td>'.$adjrink2.'</td><!--<td>'.$adjrink3.'</td> -->';
			}
			if($stype=="Speed-Quad" || $stype=="all" )
			{
                echo '<td>'.$rink1.'</td><td>'.$rink2.'</td><td>'.$rink3.'</td><td>'.$road1.'</td>';
			}
			if($stype=="Speed-Inline" || $stype=="all" )
			{
                echo '<td>'.$rink4.'</td><td>'.$rink5.'</td><td>'.$rink6.'</td><td>'.$road2.'</td><td>'.$p2p.'</td><td>'.$elim.'</td><td>'.$elimrd.'</td><td>'.$relay.'</td><td>'.$marathon.'</td>';
			}
			if($stype=="Artistic" || $stype=="all" )
			{
			echo '<td>'.$figure.'</td><td>'.$free.'</td><td>'.$combined.'</td><td>'.$pair.'</td><td>'.$inlinefree.'</td><td>'.$solodance.'</td><td>'.$pairdance.'</td><td>'.$showskating.'</td>';
			}
			if($stype=="Hockey" || $stype=="all" )
			{
				echo '<td>'.$quadhockey.'</td><td>'.$inlinehockey.'</td>';
			}
			if($stype=="Freestyle" || $stype=="all" )
			{
				echo '<td>'.$classicslalom.'</td><td>'.$speedslalom.'</td>';
			}
			echo '<td> '.$comments.' </td><td class="no-print"><a href="#myPopup" onclick="$(\'#myPopup\').show(); " data-rel="popup" data-position-to="window" data-role="button">Edit 2 -'.$appno.'</a></td><!--<td class="no-print"><a target="_blank" href="'."application.php?appno=".$appno.'">Print -'.$appno.'</a></td>--></tr>';
			


  }
echo '</tbody>';  
  ?>
</table>
<?php
	}
	else
	{
		echo "No Result Found!";
		}
	validate:
	$rowcount=0;
	




	
//}

?>
 </div>
  </div>
</body>
</html>