|
 |
|
เวลาล็อกอินเข้าใช้หน้าแอดมิน มีการประกาศตัวแปร Ses_adminUsename ไว้ แต่เวลาบันทึกผู้จองอยากให้บันทึกค่าSes_adminID ลงในฟิล์ด adminID |
|
 |
|
|
 |
 |
|

Code (tbl_service)
<?php
session_start();
$ses_adminUseName =$_SESSION["ses_adminUseName"];
if($ses_adminUseName ==""){
?>
<script language="javascript">alert("กรุณาเข้าสู่ระบบ");</script>
<script language="JavaScript"> document.location.href="login_admin.php"; </script>
<?php
} else
?>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620" />
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<?php include("header.php"); ?>
<?php include("menu.php"); ?>
<?php
include ("config.php");
$sql="select*from m_prename";
$result=mysql_query($sql,$conn) or die ("sql ผิดพลาด");
$num_rows=mysql_num_rows($result);
$sql="select*from m_sex";
$result=mysql_query($sql,$conn) or die ("sql ผิดพลาด");
$num_rows=mysql_num_rows($result);
$sql="select*from m_bloodgroup";
$result=mysql_query($sql,$conn) or die ("sql ผิดพลาด");
$num_rows=mysql_num_rows($result);
$sql="select*from m_usertype";
$result=mysql_query($sql,$conn) or die ("sql ผิดพลาด");
$num_rows=mysql_num_rows($result);
?>
<!--star content-->
<body>
<td width="75" valign="top"><div align="center">
<table width="800" border="0">
<tr>
<td><div align="center">
<form id="form1" name="form1" method="post" action="inser_service.php">
<table width="645" border="0">
<tr bgcolor="#FFCC33">
<td colspan="2"><div align="center"><strong>เพิ่มการบริการ</strong></div></td>
</tr>
<tr>
<td width="313" bgcolor="#FFFF99"><div align="right">รหัสผู้ใช้บริการ : </div></td>
<td width="322" bgcolor="#FFFF99"><label>
<input name="serviceID" type="hidden" id="serviceID" value="<? echo $serviceID; ?>" size="5" maxlength="2" readonly />
<input name="personID" type="text" id="personID" size="15" maxlength="4" />
</label></td>
</tr>
<tr>
<td bgcolor="#FFFF99"><div align="right">วันที่มาใช้บริการ : </div></td>
<td bgcolor="#FFFF99"><input type="text" name="dateService" id="dateService" value="<?php echo date('Y-m-d') ?>" readonly/></td>
</tr>
<tr>
<td bgcolor="#FFFF99"><div align="right">อาการ : </div></td>
<td bgcolor="#FFFF99"><input name="symptom" type="text" id="symptom" size="20" maxlength="30" /></td>
</tr>
<tr>
<td bgcolor="#FFFF99"><div align="right">ความดัน : </div></td>
<td bgcolor="#FFFF99"><input name="pressure" type="text" id="pressure" size="15" maxlength="4" /></td>
</tr>
<tr>
<td bgcolor="#FFFF99"><div align="right">อุณหภูมิ : </div></td>
<td bgcolor="#FFFF99"><input name="temperature" type="text" id="temperature" size="15" maxlength="6" /></td>
</tr>
<tr>
<td bgcolor="#FFFF99"><div align="right">น้ำหนัก : </div></td>
<td bgcolor="#FFFF99"><input name="weight" type="text" id="weight" size="15" maxlength="6" /></td>
</tr>
<tr>
<td bgcolor="#FFFF99"><div align="right">ส่วนสูง : </div></td>
<td bgcolor="#FFFF99"><input name="height" type="text" id="height" size="15" maxlength="6" /></td>
</tr>
<tr>
<td bgcolor="#FFFF99"><div align="right">ผู้บันทึก : </div></td>
<td bgcolor="#FFFF99"><input name="adminID" type="text" id="adminID" value="<? echo $ses_adminUseName; ?>" size="15" maxlength="1" /></td>
</tr>
<tr>
<td bgcolor="#FFFF99"> </td>
<td bgcolor="#FFFF99"><input type="submit" name="save" id="save" value="บันทึก" />
<input type="reset" name="cancel" id="cancel" onclick="history.go(-1) "value="ยกเลิก" /></td>
</tr>
</table>
</form>
</div></td>
</tr>
</table>
</div>
</table>
<?php include("footer.php"); ?>
Code (inser_service)
<?php
session_start();
$ses_adminUseName =$_SESSION["ses_adminUseName"];
?>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620" />
<?php
include("config.php");
$serviceID=$_REQUEST["serviceID"];
$personID=$_REQUEST["personID"];
$dateService =$_REQUEST["dateService"];
$symptom=$_REQUEST["symptom"];
$pressure=$_REQUEST["pressure"];
$temperature=$_REQUEST["temperature"];
$weight=$_REQUEST["weight"];
$height=$_REQUEST["height"];
$adminID=$_REQUEST["adminID"];
{
$sql="INSERT INTO service(serviceID,personID,dateService,symptom,pressure,temperature,weight,height,adminID)";
$sql.="VALUES ('$serviceID','$personID','$dateService','$symptom','$pressure','$temperature','$weight','$height','$adminID')";
echo "<meta http-equiv=\"refresh\" content=\"1;URL=tbl_service.php\">";
mysql_query($sql,$conn)
or die("ไม่สามารถเพิ่มข้อมูลลงสู่ตาราง service ได้".mysql_error());
//echo "การเพิ่มข้อมูลสมบูรณ์";
mysql_close($conn);
echo "<meta http-equiv=\"refresh\" content=\"1;URL=list_service.php\">";
}
?>
Tag : PHP

|
|
 |
 |
 |
 |
Date :
2014-02-04 22:27:17 |
By :
chaiyaphorn54 |
View :
903 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ตอนสนเรื ก็เพิ่มการประกาศตัวแปร Ses_adminID แล้วก็เอาค่ามาใช้ตอนที่จะบันทึก
|
 |
 |
 |
 |
Date :
2014-02-04 22:49:41 |
By :
Krungsri |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 00
|