|
|
|
login เข้าสู่ระบบ แล้วดึงข้อมูลที่เกี่ยวกับประวัติ ของผู้login ไปแสดงใน ฟอร์มอื่นๆ |
|
|
|
|
|
|
|
ประวัติเก็บยังไงหรอ
|
|
|
|
|
Date :
2011-09-13 23:40:27 |
By :
onedan |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ส่วนนี้จะเป็น Add_member
Code (PHP)
<title>กลุ่มการพยาบาล</title><?
$username =$_POST[username];
$pass =$_POST[pass];
$name =$_POST[name];
$surname =$_POST[surname];
$ID_ward =$_POST[ID_ward ];
if($username=="" or $pass =="" or $name =="" or $ID_ward =="" ){
echo"<script type=\"text/javascript\">alert('กรุณากรอกข้อมูลให้ครบนะค่ะ');</script>";
echo "<script type=\"text/javascript\">window.parent.location='register.php';</script>";
}
include"config.php";
$sql ="select * from nameber where username ='$username'";
$result =mysql_db_query($dbname,$sql);
$num =mysql_num_rows($result);
if($num >0){
echo"<script type=\"text/javascript\">alert('Username ซ้ำ');</script>";
exit();
}
$sql="insert into member values ('','$username','$pass','$name','$ID_ward')";
$result=mysql_db_query($dbname,$sql);
if(result){
echo"<script type=\"text/javascript\">alert('ข้อมูลถูกบันทึกเรียบร้อยแล้ว');</script>";
echo "<script type=\"text/javascript\">window.parent.location='login.php';</script>";
}
else{
echo"<script type=\"text/javascript\">alert('ไม่สามารถสมัครสมาชิกได้');</script>";
echo "<script type=\"text/javascript\">window.parent.location='register.php';</script>";
}
mysql_close();
?>
ส่วนนี้จะเป็นโค้ดหน้าฟอร์ม Register
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=windows-874" />
<title>กลุ่มการพยาบาล</title>
<style type="text/css">
body,td,th {
font-family: "action Man Shaded";
}
.style10 {font-family: "Courier New", Courier, monospace; font-size: 16px; }
.style12 {font-family: "Courier New", Courier, monospace}
.style13 {font-size: 16px}
.style14 {
color: #FF0000;
font-size: 28px;
}
</style>
</head>
<body>
<table width="800" border="2" align="center" bordercolor="#3333FF">
<tr>
<td><img src="../Pic/bg_top1_01.gif" width="895" height="32" /></td>
</tr>
<tr>
<td><img src="../Pic/blue-background_1920x1200_224-wide.gif" width="895" height="146" /></td>
</tr>
<tr>
<td><form id="form1" name="form1" method="post" action="add_member.php" target="fdata">
<br />
<table width="300" border="1" align="center" background="../Pic/pk13.jpg">
<tr>
<td colspan="2" align="center"><div align="center"><img src="../Pic/pensil.png" width="45" height="45" /><span class="style14 style13">:: Register ::</span><img src="../Pic/pensil.png" alt="j" width="45" height="45" /></div></td>
</tr>
<tr>
<td width="105"><span class="style10">username</span></td>
<td width="183"><label>
<input name="username" type="text" id="username" />
</label></td>
</tr>
<tr>
<td><span class="style10">Password</span></td>
<td><label>
<input name="pass" type="password" id="pass" />
</label></td>
</tr>
<tr>
<td height="24"><span class="style13"><span class="style12">ชื่อ
</label>
</span></span></td>
<td height="24"><label>
<input name="name" type="text" id="name" />
</label></td>
</tr>
<tr>
<td><span class="style10">Ward</span></td>
<td><select name="ID_ward" id="ID_ward">
<option value="">กรุณาเลือก Ward</option>
<?php
include('config.php');
$sql = "select * from ward where ID_ward";
$result = mysql_query($sql);
$num = mysql_num_rows($result);
for ($i=1;$i<=$num;$i++){
$row = mysql_fetch_array($result);
?>
<option value="<?php echo $row["ID_ward"] ?>"><?php echo $row["name_ward"]?></option>
<?php }
?>
</select></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input type="submit" name="Submit2" value="OK" onclick="document.all.sent.value='1';window.form1.submit();" />
<input type="reset" name="Reset" value="Reset" />
</div> </td>
</tr>
</table>
<br />
</form></td>
</tr>
<tr>
<td><img src="../Pic/bottom-en.gif" width="895" height="69" /></td>
</tr>
</table>
</body>
</html>
<iframe name="fdata" frameborder="0" marginheight=" 0" marginwidth=" 0" height=" 0" width="0" scrolling="no" src="about:blank"></iframe>
|
|
|
|
|
Date :
2011-09-14 08:55:19 |
By :
janjira0019 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|