|
|
|
พอเรากดลบแล้ว มันจะแสดง dialog "yes","no" แต่เรากด "no" มันก็ยังลบอะครับ แก้ไขอย่างไรดีคับ |
|
|
|
|
|
|
|
Code (PHP)
<?php
session_start();
include ("../connect.php");
include("chksession.php");
?>
<?
if($_GET["Action"]=="Delete")
{
$sql = "delete from rs_note where id='".$_GET["id"]."'";
$dbquery = mysql_db_query($dbname, $sql);
}
if($_GET["Action"]=="Save")
{
$sql = "insert into rs_note (id, data, name,custom) Values ('','$_POST[dataa]','$_POST[namea]','$_POST[cusnamea]')";
$dbquery = mysql_db_query($dbname, $sql);
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<title>บันทึกข้อมูล</title>
<link href="stylesheet.css" rel="stylesheet" type="text/css">
<script src="tooltip/jqueryrow.js"></script>
<script>
$(function()
{
$("#mytable tr:even").addClass("eventr");;
$("#mytable tr:odd").addClass("oddtr");;
$("#mytable tr").mouseover(function() {$(this).addClass("trover");}).mouseout(function() {$(this).removeClass("trover");}).click(function() {$(this).toggleClass("trclick");});
});
</script>
</head>
<body leftmargin="0" topmargin="0">
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td bgcolor="#EFEFEF" class=" unnamed1"><strong class="boxtitle1"> บันทึกข้อมูลของลูกค้า</strong></td>
</tr>
</table> <!-- HeadPage-->
<br>
<form name="form1" method="post" action="<?=$_SERVER['PHP_SELF'];?>?id=<?=$_GET["id"];?>&Action=Save" >
<table width="639" border="0" align="center">
<tr bgcolor="#CC3300">
<td width="716" height="24" colspan="8" align="left" bgcolor="#669933" style="color:#FFF">บันทึกของ ชื่อลูกค้า/ชื่อบริษัท
<input name="cusnamea" type="text" class="SizeRed" id="cusnamea" size="20" value="<?=$_POST["cusnamea"];?>"readonly/>
รายชื่อลูกค้า[ใบจอง]
<select name="fnamejon" id="fnamejon" onChange="bind(this)" >
<option value="" id="s0<?= $fnamejon ?>" >-- Select --</option>
<?php
$q="select * from rs_custom order by numberj ";
$qr=mysql_query($q);
while($rs=mysql_fetch_array($qr)){
?>
<option value="<?=$rs['fnamejon']?>"><?=$rs['fnamejon']?></option>
<?php } ?>
</select>
</td>
</tr>
<tr>
<td height="89">
<input name="add" type="hidden" id="add" value="1">
<fieldset name="Group1">
<textarea name="dataa" id="dataa" cols="93" rows="3" class="SizeRed" >
</textarea>
<div id="progressbar1" class="progress"></div>
<p>ผู้บันทึก :
<INPUT NAME="namea" TYPE="text" CLASS="input-text" id="namea" value="<?
if ($emplevel == "9"){
echo "$empnameweb.";
}else{
echo "$empnameweb.";
}
?>" readonly="readonly"/>
<input name="Submit" type="image" src="images/add_16.png" id="Submit" />
</p>
</fieldset>
</td>
</tr> <!-- textfield-->
</table>
</form>
<table width="100%" border="0" cellspacing="0" cellpadding="1" >
<tr>
<td width="58%" align="right" > </td>
<form id="form2" name="form2" method="post" action="note.php">
<td width="21%" align ="right" class=" unnamed1" >
<input name="txt_search" class="tb11" type="text" id="txt_search" value="พิมพ์ชื่อลูกค้าที่ต้องการค้นหา ที่นี่ !" onblur="checkValue(this,this.defaultValue)"
onfocus="clearValue(this,this.defaultValue)" />
</td>
<td width="21%" align="left">
<input name="Search" type="image" src="images/search1.gif" title="ค้นหา" height="18" /></td>
</form>
</tr>
</table>
<table width="70%" align="center" style="cursor:pointer" id="mytable" cellspacing="1">
<tr bgcolor="#BBC9FF" class="unnamed1" >
<td width="33" height="25" bgcolor="#3399FF" ><div align="center">ลำดับ</div></td>
<td width="110" height="25" bgcolor="#3399FF" ><div align="center">ลูกค้า/กลุ่มบริษัท</div></td>
<td width="572" bgcolor="#3399FF"><div align="center">รายละเอียด</div></td>
<td width="73" bgcolor="#3399FF"><div align="center">ผู้บันทึก</div></td>
<td width="39" class="unnamed2" bgcolor="#3399FF"><div align="center">ลบ</div></td>
</tr>
<?
$txt_search = $_POST['txt_search'];
$sql="select * from rs_note where custom LIKE '%$txt_search%' order by id ";
//echo"$sql";
$dbquery = mysql_db_query($dbname, $sql);
$num_rows = mysql_num_rows($dbquery);
$i=0;
while ($i < $num_rows)
{
$result = mysql_fetch_array($dbquery);
$id = $result[0];
$data = $result[1];
$name = $result[2];
$custom = $result[3];
$order = $i+1;
?>
<tr class="unnamed1" >
<td height="20"><div align="center"><span class="unnamed2"><? echo"$order"; ?>
</span></div></td>
<td><div align="center"><? echo"$custom"; ?></div></td>
<td><div align="center"><? echo"$data"; ?></div></td>
<td><div align="center"><? echo"$name"; ?></div></td>
<td ><div align="center"><a href="<?=$_SERVER['PHP_SELF'];?>?Action=Delete&id=<?=$result["id"];?>" onclick="return confirm('ข้อมูลที่สำคัญของคุณ.<?=$result["custom"]; ?> จะถูกลบออก ?');" >ลบ</a></div>
</td>
</tr>
<?
$i++;
}
?>
</table>
<p> </p>
</body>
</html>
<script language="javascript">
function bind(objSelect){
document.getElementById("cusnamea").value = objSelect.options[objSelect.selectedIndex].value;
}
</script>
Tag : PHP, MySQL
|
|
|
|
|
|
Date :
2010-08-27 00:58:38 |
By :
ลูกน้อย |
View :
1059 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
a href="javascript:void(0)" onclick="return if(confirm('ข้อมูลที่สำคัญของคุณ.<?=$result["custom"]; ?> จะถูกลบออก ?')==true){window.location='<?=$_SERVER['PHP_SELF'];?>?Action=Delete&id=<?=$result["id"];?>';};" >ลบ</a>
|
|
|
|
|
Date :
2010-08-27 06:20:51 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|