|
|
|
ช่วยแก้โค้ดให้หน่อย ฮะ code update ทำไงไม่รู้มันบ่อัพเดท |
|
|
|
|
|
|
|
นิทานเรื่องนี้มันมีอยู่ว่า
ตอนแรกเป็นหน้าอัพเดทแล้วพอคลิกปุ่มอัพเดท มันจะโชว์หน้านี้โดยมีค่าอยู่ในเท็กฟิลอยู่แล้วแต่ในเท็กฟิลมันไม่โชว์ โค้ดมันก็
Code (PHP)
<?
include('db_connect.php');
include('header.php');
include('left.php');
extract($_GET);
$u_name = $flag;
?>
<link href="style.css" rel="stylesheet" type="text/css" />
<td width="421" rowspan="2"><div align="center">
<table width="655" border="0" align="center" cellpadding="0" cellspacing="5" bordercolor="#FFFFAA">
<tr>
<?
$query = "Select * from user_info where u_name = '$u_name'";
$result = mysql_query($query);
while($result_row = mysql_fetch_row($result))
{
?>
<td width="645" height="131"><div id="container">
<p id="headerp">User Information Update </p>
<p></p>
<form id="add_user" name="add_user" method="post" action="u_add_info.php" class="other">
<table width="379" border="0" align="center" cellpadding="5">
<tr>
<td width="116" class="other">User name:</td>
<td width="237" class="c_l_text"><input name="u_name" type="text" id="u_name" value="<? echo $result_row[0]; ?>" /></td>
</tr>
<tr>
<td class="other">Password:</td>
<td class="c_l_text"><input name="pws" type="password" id="pws" onkeypress="check_number()" value="<? echo $result_row[1]; ?>" /></td>
</tr>
<tr>
<td class="other">Status:</td>
<td class="c_l_text"><input name="status" type="text" id="status" onkeypress="check_number()" value="<? echo $result_row[2]; ?>"/></td>
</tr>
<tr>
<td class="other"><label>Staff ID:</label></td>
<td class="c_l_text"><input name="st_id" type="text" id="st_id" onkeypress="check_number()" value="<? echo $result_row[3]; ?>"/></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="Enter" onclick="chksumit()"/>
<input type="reset" name="Submit2" value="Cancel" /></td>
</tr>
</table>
<p> </p>
</form>
</div>
</td>
</tr>
<?
}
?>
</table>
</div></td>
<div align="center">
</div>
<tr>
<td> </td>
<td> </td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<?
include('footer.php');
?>
<script>
function check_number() {
e_k=event.keyCode
if (((e_k < 48) || (e_k > 57)) && e_k != 46 && e_k != 10) {
//if (e_k != 13 && (e_k < 48) || (e_k > 57) || e_k == ) {
event.returnValue = false;
alert("Please insert number only");
}
}
function chksumit()
{
if(document.add_user.u_name.value=="")
{
event.returnValue = false;
alert("Please insert name");
document.add_user.u_name.focus();
}else
if(document.add_user.pws.value=="")
{
event.returnValue = false;
alert("Please insert address");
document.add_user.pws.focus();
}else
if(document.add_user.cmd.value=="")
{
event.returnValue = false;
alert("Please insert mobile number");
document.add_user.cmd.focus();
}else
if(document.add_user.st_id.value=="")
{
event.returnValue = false;
alert("Please insert mobile number");
document.add_user.st_id.focus();
}else
{
document.add_user.submit();
}
}
</script>
ส่วนอีกอันกดอัพเดท แล้วก็ยังไม่ไป
Code (PHP)
<?php
include('db_connect.php');
$u_name = $_POST['u_name'];
$pws = $_POST['pws'];
$status = $_POST['status'];
$st_id = $_POST['st_id'];
$sql = "update user_info set u_name = '$u_name' , pws = '$pws' , status = '$status' , st_id = '$st_id' WHERE u_name = '$u_name' ;";
mysql_query($sql);
?>
<meta http-equiv='refresh' content='5;URL=m_user.php' />
<style type="text/css">
<!--
.style1 {font-size: 36px}
body {
background-color: #01111B;
}
.style2 {font-size: 36px; color: #FFFFFF; }
-->
</style>
<td width="421" rowspan="2" bgcolor="#01111B"><div align="center">
<table width="611" border="0" align="center" cellpadding="0" cellspacing="5" bordercolor="#FFFFAA">
<tr>
<td width="601" height="131"><div id="container">
<p align="center" class="style2" id="headerp">Update New Information was Successfully </p>
<p align="center" class="c_l_text"><img src="images/wait.gif" width="16" height="16" /></p>
<table width="389" border="0" align="center" cellpadding="5">
<tr>
<td width="171" class="style2">User name</td>
<td width="192" class="style2"><? echo "$u_name"; ?></td>
</tr>
<tr>
<td class="style2">Password</td>
<td class="style2"><? echo "$pws"; ?></td>
</tr>
<tr>
<td class="style2">Status</td>
<td class="style2"><? echo "$status"; ?></td>
</tr>
<tr>
<td class="style2">Staff ID </td>
<td class="style2"><? echo "$st_id"; ?></td>
</tr>
</table>
<p>d<span class="style2">Delete after code finish </span></p>
<p><br />
</p>
</div>
<p class="style1"> </p>
<p> </p>
<p> </p> </td>
</tr>
</table>
</div></td>
<div align="center">
</div>
<tr>
<td> </td>
<td> </td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
กราบขอบพระคุณอย่างยิ่ง สำหรับคนมาแก้ให้
|
|
|
|
|
Date :
2009-10-17 12:17:43 |
By :
Fursan |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|