<style type="text/css">

.content{
	color: oldlace;
	font-weight: bold;
}
.textbox{
	color: brown;
	font-weight: bold;
	}
	.btn{
		border-radius: 8px 8px;
		background: crimson;
		padding: 7px 10px 7px 10px;
		color: white;
		font-weight: bold;
	}
</style>
<?php
include("../db.php");
if($_REQUEST["type"]=="student"){
	 $cast=$db->getRows("select idno,name from student where school_id='".$_SESSION["admin"]["school_id"]."' and class='".$_REQUEST["cls"]."' and session='".$_SESSION["admin"]["session"]."' and status=1 and issue_TC=0 order by name"); 
	//print_r($cast);
	?>
	<select name="idno" id="student_name">
		<option value="">select</option>
		<?php 
		if(is_array($cast) && count($cast)>0){
			foreach($cast as $c){ ?>
			<option class="textbox" value="<?php echo $c["idno"] ?>"><?php echo $c["name"] ?></option>
			<?php
			}
		}
		?>
		
	</select>
    <?php                  	
}else{
$fna=md5(microtime()). '.jpg';
$filename = "../media/photo/".$fna ;
$result = file_put_contents( $filename, file_get_contents('php://input') );
if (!$result) {
	print "ERROR: Failed to write data to $filename, check permissions\n";
	exit();
}
echo "<h1 style='color:yellowgreen;'>Please enter Detail</h1>";
?>
<form target="_blank" method="post" action="../print/gateentry.php">
<input type="hidden" name="photo" value="<?php echo $fna ?>" />
<table>
	<tr>
    	<td class="content">Select Class</td>
        <td><select onchange="changeStudent($(this).val())" id="class">
                <option class="textbox" value="">Class</option>
                <?php 
                    $class=$db->getRows("select * from class  where school_id='".$_SESSION["admin"]["school_id"]."'");
                    foreach($class as $cla){
                        ?>
                        <option class="textbox" value="<?php echo $cla["class"] ?>">
                            <?php echo $cla["class"] ?>
                        </option>
                        <?php
                    }
                ?>
            </select></td>
    </tr>
    <tr>
    	<td class="content">School Stduent</td>
        <td><div id="studentList">
        <select name="idno">
        	<option class="textbox" value="">Select student name</option>
        </select>
        </div>
        </td>
    </tr>
    <tr>
    	<td class="content">Visitor name</td>
        <td><input class="textbox" type="text" name="name" /></td>
    </tr>
    <tr>
    	<td class="content">Visitor Relation</td>
        <td><input class="textbox" type="text" name="relation" /></td>
    </tr>
    <tr>
    	<td class="content">Visitor Contact no</td>
        <td><input class="textbox" type="text" name="contact" /></td>
    </tr>
    <tr>
    	<td></td>
        <td><input class="btn"  type="submit"  value="Create GATE Pass" /></td>
    </tr>
</table>
</form>

<?php }?>