$sql="select * from registeredit where email='$email'";
$result = mysql_query($sql,$link);
$num =mysql_num_rows($result);
if($num>0)
{
print("<br>");
print(" "." "." "." "." "." "." "." "." "." "." "." "." "." "." "." "." "." "." "." "." "." "." "." "." "." "." "." "."email นี้มีคนใช้แล้ว");
}
else
{
addmember();
$link=mysql_connect("localhost","sccem","cemmath");
mysql_select_db("cemdata",$link);
$query="INSERT INTO `registeredit` (`email`,`password`,`status`,`title`,`firstname`,`lastname`,`affiliation`,`address`,`phone1`,`phone2`,`country`,`city`,`idcard`,`idcardANDPAssport`,`flightno`,`arivalTime`,`hotel`,`special`,`totalcost`) VALUES ('$email','$password','$status','$title','$firstname','$lastname','$affiliation','$address','$phone1','$phone2','$country','$city','$idcard','$idcardANDPAssport','$flightno','$arivalTime','$hotel','$special','$totalcost')";
mysql_query( $query , $link );
mysql_close($link);
print(" "." "." "." "." "." "." "." "." "." "." "." "." "." "." "." "." "." "." "." "." "." "." "." "." "." "." "." "."Data has been recorded.");
print("<br>");
print "EMAIL ADDRESS :"." ".$email;
print("<br>");
//print "PASSWORD :"." ".$password;
//print("<br>");
print "Totalcost :"." ".$totalcost;
print("<br>");
print "Please wait,detail of your registration will be sent to you address.";
print("<br>");
// ส่งเมลล์
$email_from='http://www.sc.mahidol.ac.th/cem';
$subject='User & Password (http://www.sc.mahidol.ac.th/cem)?';
$header="from: $email_from";
$messages.= "Hello \n";
$messages.= "This email is for user and password \n\n";
$messages.= "e-mail address and password are needed every time you sign in.\n";
$messages.= "please keep this e-mail. \n\n";
$messages.= "Thank you \n\n";
mail($email,$subject,$messages,$header);
print(" "." "." "."The password has been sent to $email");
print("<br>");
print(" "." "." "."Please check your Email. if you cannot find the message in your mailbox, please check your junk mails");