 |
|
Code (PHP)
<?php
include "config.php";
include "function.php";
if(empty($_POST[name])){
echo "<script> alert('กรุณากรอกชื่อลูกค้าด้วยค่ะ !');window.history.back();</script>";
exit;
}
if(empty($_POST[surname])){
echo "<script> alert('กรุณากรอกนามสกุลด้วยค่ะ !');window.history.back();</script>";
exit;
}
if(empty($_POST[address])){
echo "<script> alert('กรุณากรอกที่อยู่ด้วยค่ะ !');window.history.back();</script>";
exit;
}
if(empty($_POST[postcode])){
echo "<script> alert('กรุณากรอกรหัสไปรษณีย์ด้วยค่ะ !');window.history.back();</script>";
exit;
}
if(empty($_POST[phone])){
echo "<script> alert('กรุณากรอกหมายเลขโทรศัพท์ด้วยค่ะ !');window.history.back();</script>";
exit;
}
if(empty($_POST[email])){
echo "<script> alert('กรุณากรอกอีเมล์ด้วยค่ะ !');window.history.back();</script>";
exit;
}
if(empty($_POST[username])){
echo "<script> alert('กรุณากรอกชื่อในการเข้าระบบด้วยค่ะ !');window.history.back();</script>";
exit;
}
if(empty($_POST[pass])){
echo "<script> alert('กรุณากรอกรหัสผ่านด้วยค่ะ !');window.history.back();</script>";
exit;
}
if(empty($_POST[repass])){
echo "<script> alert('กรุณายืนยันรหัสผ่านด้วยค่ะ !');window.history.back();</script>";
exit;
}
if($_POST[pass]<>$_POST[repass]){
echo "<script> alert('รหัสผ่านไม่ตรงกันกรุณาตรวจสอบด้วยค่ะ !');window.history.back();</script>";
exit;
}
$sql = insert("id,name,surname,address,province,postcode,phone,email,username,pass,uid"," '','$_POST[name]','$_POST[surname]','$_POST[address]','$_POST[province]','$_POST[postcode]','$_POST[phone]','$_POST[email]','$_POST[username]','$_POST[pass]','1' ","member");
if($sql){
echo "<script> alert('บันทึกข้อมูล คุณ $_POST[name] $_POST[surname] เรียบร้อยแล้วค่ะ !'); window.location='index.php';</script>";
exit;
}
?>
//แกะเอานะ ตรง $sql ก็เปลี่ยนซะนะถ้าหากจะเอาไปใช้ในการเพิ่มข้อมูล
|
 |
 |
 |
 |
Date :
2010-10-01 09:41:15 |
By :
Manussawin |
|
 |
 |
 |
 |
|
|
 |