|
|
|
เวลาจะ Update ข้อมูลให้แสดงขึ้นมาว่าจะ Update จริงหรือไว้ให้ตอบ yes กับ No |
|
|
|
|
|
|
|
เวลาจะกดบุ๋ม แก้ไขให้แสดงบุ๋มกดว่าจะ yes หรือ no คือจะแก้ไขจริงหรือไม่ ถ้าตอบ yes ก็แก้ไข no ก็ไม่แก้ไข
from1
<?
$sql = "SELECT SalemanID, FLName FROM tbsaleman WHERE Status = 'T' AND Active = 'A'";
$query = mysql_db_query($dbname, $sql) or die("Can't Query1");
?>
<table width="1100" border="1">
<tr>
<th width="100"> <div align="center">FLName </div></th>
<th width="100"> <div align="center">แก้ไข </div></th>
<th width="100"> <div align="center">ลบ </div></th>
</tr>
<?
while($SalemanID = mysql_fetch_array($query))
{
?>
<tr>
<td><div align="center"><?=$SalemanID["FLName"];?></div></td>
<td align="center"><a href="formB2_edit.php?SalemanID=<?=$SalemanID["SalemanID"];?>">แก้ไข</a></td>
<td align="center"><a href="formB2_delect.php?SalemanID=<?=$SalemanID["SalemanID"];?>">ลบ</a></td>
</tr>
</form>
</tr>
<?
}
?>
from1code
<?
include('connect.php');
include('formB1.php');
$id = $_POST["txtCode"];
//$LastUpdate = $_POST["txtDate"];
$Company = $_POST["txtName"];
$CurAdd1 = $_POST["txtAddress"];
$Tel = $_POST["txtPhone"];
$Fax = $_POST["txtFax"];
$Email = $_POST["txtEmail"];
$Website = $_POST["txtWeb"];
$ContactPerson1 = $_POST["txtConnect"];
$ContactPosition1 = $_POST["txtPosition"];
$Credit = $_POST["txtCredit"];
$Remark = $_POST["txtComment"];
$Active = $_POST["checkbox"];
if($_POST["checkbox"] != "")
{
$Active = "I";
}
else
{
$Active = "A";
}
// $sql = "SELECT MAX(CustID) FROM tbcustomer";
// $query = mysql_db_query($dbname, $sql) or die("Can't Query");
// $cus_id = mysql_fetch_array($query);
// $id = $cus_id[0] + 1 ;
$sql= " UPDATE tbcustomer SET Company = '$Company', Credit = '$Credit', CurAdd1 = '$CurAdd1', ContactPerson1 = '$ContactPerson1', ContactPosition1 = '$ContactPosition1', Tel = '$Tel', Fax = '$Fax', Email = '$Email', Website = '$Website', Remark = '$Remark',LastUpdate = now()
, Active = '$Active' WHERE CustID = '$id' ";
$query = mysql_db_query($dbname, $sql) or die("Can't Query");
if($query)
{
echo " <script language='javascript'>
alert('Update Success');
window.location='fromB1.php';
</script>
";
}else
{
echo " <script language='javascript'>
alert('Fail');
window.location='fromB1.php';
</script>
";
}
mysql_close();
?>
Tag : PHP
|
|
|
|
|
|
Date :
2011-09-13 11:35:56 |
By :
tangsupap |
View :
781 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (JavaScript)
<html>
<head>
<title>ThaiCreate.Com Tutorial</title>
</head>
<body>
<script language="javascript">
function fncSubmit()
{
if(confirm('Confirm to submit')==true)
{
return true;
}
else
{
return false;
}
}
</script>
<form action="page.cgi" method="post" name="form1" onSubmit="JavaScript:return fncSubmit();">
<input name="txtName" type="text" id="txtName">
<input name="btnSubmit" type="submit" value="Button">
</form>
</body>
</html>
ตามนี้เลยครับ
Go to : JavaScript OnSubmit
|
|
|
|
|
Date :
2011-09-13 11:55:28 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|