<?php 
include("config.inc.php") ;

echo "->" . $date;

mysql_select_db($db) ;

mysql_query("SET character_set_results=tis620");
mysql_query("SET character_set_client=''tis620''");
mysql_query("SET character_set_connection=''tis620''");
mysql_query("collation_connection = tis620_thai_ci");
mysql_query("collation_database = tis620_thai_ci");
mysql_query("collation_server = tis620_thai_ci");
 

// ถ้ากรอกอีเมล์ไม่ถูกต้อง
if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)$",$email)){
echo "<br><br><center><font size='3' face='MS Sans Serif'><b>กรุณากรอกอีเมล์ให้ถูกต้องด้วยครับ</b></font>" ;
echo "<br><br><input type='button' value='edit email' onclick='history.back();'></center>" ;
exit() ;
}


$signup = date("j/n/").(date("Y")+543) ;

$name = htmlspecialchars($name) ;
$address = htmlspecialchars($address) ;
$zipcode = htmlspecialchars($zipcode) ;
$phone = htmlspecialchars($phone) ;


	    $sql[0] = "update member set name='$name' where member_id='$member_id' ";
		
		$sql[1]= "update member set sex='$sex' where member_id='$member_id' ";
		
		$sql[2] = "update member set date='$date' where member_id='$member_id' ";
       
        $sql[3] = "update member set month='$month' where member_id='$member_id' ";
               
        $sql[4] = "update member set year='$year' where member_id='$member_id' ";
      
		$sql[5] = "update member set work='$work' where member_id='$member_id'";
	
		$sql[6] = "update member set age='$age' where member_id='$member_id' ";
	
		$sql[7] = "update member set email='$email' where member_id='$member_id' ";
	
		$sql[8] = "update member set address='$address' where member_id='$member_id' ";
	
		$sql[9] = "update member set amper='$amper' where member_id='$member_id' ";
		
		$sql[10] = "update member set province='$province' where member_id='$member_id' ";
	
	    $sql[11] = "update member set zipcode ='$zipcode' where member_id='$member_id' ";

		$sql[12] = "update member set phone='$phone' where member_id='$member_id' ";
	
		$sql[13] = "update member set education='$education' where member_id='$member_id' ";
		
	   $sql[14] = "update member set work='$work' where member_id='$member_id' ";
	
      mysql_db_query($db,"SET NAMES tis620");// 
       for($i=0;$i<15;$i++) {
	     echo "<br>\$sql[$i] ".$sql[$i];
         $result = mysql_query($sql[$i]) or die("Err program")  ;
       }


if($result) {
echo "<br><br><center><font size=\"3\" face='MS Sans Serif'><b>รายละเอียดของคุณ ได้ถูกบันทึกใหม่แล้วครับ</b></font></center>" ;
echo "<meta http-equiv='refresh' content='4; url=member_detail.php'>" ;
}



?>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
</head>

<body>

</body>
</html>
