|
 |
|
ใครก็ได้ ช่วยดูที ครับ หรือ ใครพอจะรู้วิธี insert ข้อมูลแบบ หลายตาราง ด้วยการส่งจาก form 1 formบ้าง |
|
 |
|
|
 |
 |
|
Code (PHP)
<!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>
<?php
include "config.in.php";
$sql= "SELECT * FROM graduated_profile WHERE IDCard_Num = '$IDCard_Num' ";
$query = mysql_query($sql);
$rs = mysql_fetch_array($query);
if($rs){
?>
<script>
alert("เลขบัตรประจำตัวประชาชน\nหรือรหัสประจำตัวนักศึกษาซ้ำ");
</script>
<?
echo "<meta http-equiv='refresh' content='0;url=questionnaire.php'>";
}else{
//tatle1
$sql1="insert into graduated_profile(
Prefix,Prefix_Ohter,
Name,LName,
DateOfBirth,
IDCard_Num,Semester_Type,
Course_Type,GPA,Program,
Student_ID,Home_Number,Mu,
Village_Name,Lane,Road,
Distric,City,Province,
Postcode,Home_Tel,Mobile,
Fax,Email
)values(
'".$_POST[Prefix]."','".$_POST[Prefix_Other]."',
'".$_POST[Name]."','".$_POST[LName]."',
'".$_POST[DateOfBirth1].'/'.$_POST[DateOfBirth2].'/'.$_POST[DateOfBirth3]."',
'".$_POST[IDCard_Num]."','".$_POST[Semester_Type]."',
'".$_POST[Course_Type]."','".$_POST[GPA]."','".$_POST[Program]."',
'".$_POST[Student_ID]."','".$_POST[Home_Number]."','".$_POST[Mu]."',
'".$_POST[Village_Name]."','".$_POST[Lane]."','".$_POST[Road]."',
'".$_POST[Distric]."','".$_POST[City]."','".$_POST[Province]."',
'".$_POST[Postcode]."','".$_POST[Home_Tel]."','".$_POST[Mobile]."',
'".$_POST[Fax]."','".$_POST[Email]."')";
//tatle2
$sql2="insent info awards (
Student_ID,Get_Awrd,
Award_Name1,Name1,
Award_Type1,Award_Type_Other1
) values (
'".$_POST[Student_ID]."','".$_POST[Get_Awrd]."',
'".$_POST[Award_Name1]."','".$_POST[Name1]."',
'".$_POST[Award_Type1]."','".$_POST[Award_Type_Other1]."')";
$query=mysql_query($sql1&$sql2);
if($query){
?>
<script>
alert("เพิ่มข้อมูล เรียบร้อยแล้ว");
</script>
<?
echo "<meta http-equiv='refresh' content='0;url=questionnaire.php'>";
}else{
?>
<script>
alert("ไม่สามารถเพิ่มข้อมูลได้");
</script>
<?
echo "<meta http-equiv='refresh' content='0;url=questionnaire.php'>";
}
}
?>
</body>
</html>
Tag : PHP, MySQL

|
|
 |
 |
 |
 |
Date :
2011-03-17 22:00:59 |
By :
ckcr |
View :
771 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Student_ID ด้วยตัวนี้ เป็นครีหลัก
|
 |
 |
 |
 |
Date :
2011-03-17 22:02:56 |
By :
ckcr |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 05
|