<?php
include "connect.php";

$nim= $_COOKIE['nim'];
$kd_byr= $_COOKIE['kd_byr'];
$cek = mysql_query("select * from temp where nim='$nim' AND kd_byr='$kd_byr'");
$hasil=mysql_num_rows($cek);
if($hasil>0)
{
die("sudah pernah input");
}

//simpan data

foreach($_POST['nim'] as $key => $nim){  
$sql = "insert into temp (nim,kd_byr) values ('{$_POST['nim'][$key]}', '{$_POST['kd_byr']}')";  
mysql_query($sql);  
}  
if ($sql)
{
header("location:fregkeu.php");
}
else
{
echo "Poses Input Gagal";
}
?>


