<!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" /> <title>Untitled Document</title> </head> <body> <? include("condbm.php"); $id_card =$_POST['id_card']; $name_std =$_POST['name_std']; $lastname_std =$_POST['lastname_std']; $tel_std =$_POST['tel_std']; $email_std =$_POST['email_std']; $branch_std =$_POST['branch_std']; $great_std =$_POST['great_std']; $jobtitle =$_POST['jobtitle']; $location_office =$_POST['location_office']; $thesis =$_POST['thesis']; $degree =$_POST['degree']; if( (empty($id_card))||(empty($name_std))||(empty($lastname_std))||(empty($tel_std)) ||(empty($email_std))) { ?> <form name="frmMain" action="indexmain.php?f=sheeregis" method="POST" > </form> <script>document.getElementsByTagName("form")[0].submit();</script> <? } $sqlid=mysql_query("SELECT * FROM sheeregis Where id_card='".$id_card."'"); if(mysql_num_rows($sqlid)>=1){ echo "<script type=\"text/javascript\">"; echo "alert(\"รหัสบัตรประชาชนนี้สมัครใช้งานแล้ว...\");"; echo "window.history.back();"; echo "</script>"; exit(); } date_default_timezone_set("Asia/Bangkok"); $datere=date("Y-m-d"); $timere=date("H:i:s"); $pictc1 = pathinfo(basename($_FILES['pictc']['name']),PATHINFO_EXTENSION); $new_nametc = "tc".$tel_std.rand(0,9).".".$pictc1; $picslip1 = pathinfo(basename($_FILES['picslip']['name']),PATHINFO_EXTENSION); $new_nameslip = "sl".$tel_std.rand(0,9).".".$picslip1; $SQLADDS1 = "INSERT INTO sheeregis VALUES ('$id_card','$degree','$name_std','$lastname_std','$tel_std', '$email_std','$branch_std','$great_std','$jobtitle','$location_office', '$thesis','$new_nameslip','$new_nametc','','$datere',' $timere')"; if(mysql_query($SQLADDS1)){ move_uploaded_file($_FILES['pictc']['tmp_name'],'transcript/'.$new_nametc); move_uploaded_file($_FILES['picslip']['tmp_name'],'slip/'.$new_nameslip); ?> <form name="frmMain" action="indexmain.php?f=reportstdregis" method="POST" > <input type="hidden" name="id_card" value="<?php echo $id_card ;?>" /> <input type="hidden" name="repxx" value="ckrepxx" /> </form> <script>document.getElementsByTagName("form")[0].submit();</script> <? } else { die ("Error in query: $SQLADDS1 "); } ?> </body> </html>