<?php
include "connect.php";
//definisikan variabel dari Formmhs
//if($_FILES['photo']['size'] > 0 && $_FILES['photo']['error'] == 0){
$tgl_daf   = $_POST['tgl_daf'];
$no_cmhs   = $_POST['no_cmhs'];
$nm_cmhs   = addslashes($_POST['nm_cmhs']);
$kota_lhr  = $_POST['kota_lhr'];
$tgl_lhr   = $_POST['tgl_lhr'];
$agama     = $_POST['agama'];
$jenkel    = $_POST['jenkel'];
$tbadan    = $_POST['tbadan'];
$bbadan    = $_POST['bbadan'];
$alamat    = $_POST['alamat'];
$telp      = $_POST['telp'];
$sklh_asal     = $_POST['sklh_asal'];
$rekomendasi   = $_POST['rekomendasi'];
$wali          = $_POST['wali'];
$prog_study    = $_POST['prog_study'];
$ta    	       = $_POST['ta'];
$ket    	   = $_POST['ket'];
$gel    	   = $_POST['gel'];
$tmpFile   = fopen($_FILES['photo']['tmp_name'], 'rb');
$fileData  = fread($tmpFile, filesize($_FILES['photo']['tmp_name']));
$fileData  = addslashes($fileData);
//simpan data
$input ="insert into cmhs(no_cmhs,tgl_daf,nm_cmhs,kota_lhr,tgl_lhr,agama,jenkel,tbadan,bbadan,alamat,telp,sklh_asal,rekomendasi,wali,prog_study,photo,ta,ket,gel)
 values('$no_cmhs','$tgl_daf','$nm_cmhs','$kota_lhr','$tgl_lhr','$agama','$jenkel','$tbadan','$bbadan','$alamat','$telp','$sklh_asal','$rekomendasi','$wali','$prog_study','$fileData','$ta','$ket','$gel')";
mysql_query($input);
if ($input)
{
header("location:tampilcmhs.php");
}
else
{
echo "Poses Input Gagal";
}
//}
?>

