<?php
include("../db.php");
if($_REQUEST["type"]=="student"){
	 $cast=$db->getRows("select idno,name,admissionno 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="">selects</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"].' -('.$c["admissionno"].')' ?></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 trim($fna);
    }
?>