|
|
|
เกี่ยวกับ popup ที่ต้องการให้ปิดตัวเองเมื่อแก้ไขเสด และรีเฟสข้อมูลในหน้า index.php |
|
|
|
|
|
|
|
//////////////////////////index.php//////////////////
<html>
<HEAD><meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<script type="text/javascript">
function popup(url,name,windowWidth,windowHeight){
myleft=(screen.width)?(screen.width-windowWidth)/2:100;
mytop=(screen.height)?(screen.height-windowHeight)/2:100;
properties = "width="+windowWidth+",height="+windowHeight;
properties +=",scrollbars=yes, top="+mytop+",left="+myleft;
window.open(url,name,properties);
}
</SCRIPT>
</HEAD>
<body >
<form action="seach.php" method="post"><!-- ¡ÒÃÊ觼èÒ¹¢éÍÁÙÅ -->
<input type="text" name="seach" >
<input type="submit" value="¤é¹ËÒ">
</form>
<?//µÔ´µèÍ°Ò¹¢éÍÁÙÅ
$host = "localhost";
$username = "root";
$password = "";
$link = mysql_connect($host, $username, $password);
$db_name = "tot_project";
mysql_select_db($dbname, $link);
mysql_query("Set NAMEs tis620") or die(mysql_error());
$sql_query = "select * from datas";
$result = mysql_db_query($db_name, $sql_query) or die(mysql_error());
mysql_close($link);//»Ô´°Ò¹¢éÍÁÙÅ
?>
<table border=2 cellspacing=0 >
<tr>
<td><center>No. <center></td>
<td><center>ª×èÍä¿Åì<center></td>
<td><center>ä¿Åì<center></td>
<td><center>ªØÁÊÒÂ<center></td>
<td><center>Çѹ/à´×͹/»Õ<center></td>
<td><center>àÇÅÒ<center></td>
<td><center>ÍèÒ¹ä¿Åì<center></td>
<td><center>Download<center></td>
</tr>
<!-- ¤Çº¤ØÁ¡Ò÷ӧҹ -->
<?while ($row = mysql_fetch_array($result)) {?>
<tr>
<td><center><?$id_p = $row["id_p"]; echo "$id_p" ;?></center></td>
<td><center><?$File_Name = $row["File_Name"]; echo "$File_Name" ;?></center></td>
<td><center><?$File = $row["File"]; echo "$File" ;?></center></td>
<td><center><? $Exchanges = $row["Exchanges"]; echo "$Exchanges";?></center></td>
<td><center><?$Date = $row["Date"]; echo "$Date";?></center></td>
<td><center><?$Time= $row["Time"]; echo "$Time";?></center></td>
<td><center><?$Read_File= $row["Read_File"]; echo "$Read_File";?></center></td>
<td><center><?$Download= $row["Download"]; echo "$Download";?></center></td>
<td><center><a href="javascript:popup('http://localhost/tot/edit.php?id_p=<? echo $id_p;?>','' ,400,400)" >á¡éä¢</a></center></td>
<td><center><a href = "del.php?id_p=<? echo $id_p; ?>"onclick="return confirm('Â×¹Âѹ¡ÒÃź¢éÍÁÙÅ')">ź</a></center></td>
</tr><? } ?>
</table>
</body>
</html>
..............................................
////////////////////edit.php/////////////
<?
$id_p=$_GET['id_p'];
include("connect.php");
$sql_edit = "select * from datas where id_p = '$id_p'";
$result = mysql_query($sql_edit) or die(mysql_error());
$row = mysql_fetch_array($result);
list ($id_p,$File_Name,$File,$Exchanges,$Date,$Time,$Read_File,$Download) = $row;
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
</head>
<body ><U>á¡é䢢éÍÁÙÅ</U><br>
<form action="edit_action.php" method="post" >
<input type="hidden" name="id_p" value="<?=$id_p ?>">
ª×èÍä¿Åì :<INPUT TYPE="text"NAME="File_Name" value="<?=$File_Name ?>"><br>
ä¿Åì :<INPUT TYPE="text"NAME="Files" value="<?=$File ?>"><br>
ªØÁÊÒ : <INPUT TYPE="text"NAME="Exchanges" value="<?=$Exchanges ?>"><br>
Çѹ/à´Ô͹/»Õ :<INPUT TYPE="text"NAME="Dates" value="<?=$Date ?>"><br>
àÇÅÒ :<INPUT TYPE="text"NAME="Times" value="<?=$Time ?>"><br>
ÍèÒ¹ä¿Åì :<INPUT TYPE="text"NAME="Read_File" value="<?=$Read_File ?>"><br>
Download :<INPUT TYPE="text"NAME="Download" value="<?=$Download ?>"><br>
<INPUT TYPE="submit" value="Save">
</FORM>
</td>
</body>
</html>
......................................................
//////////////////edit_action.php/////////////////////////
<?
$id_p=$_POST[id_p];
$File_Name= $_POST[File_Name];
$File= $_POST[Files];
$Exchanges= $_POST[Exchanges];
$Date= $_POST[Dates];
$Time= $_POST[Times];
$Read_File= $_POST[Read_File];
$Download= $_POST[Download];
include("connect.php");
$sql_update = "update datas set File_Name='$File_Name',File='$File',Exchanges='$Exchanges',Date='$Date',Time='$Time',Read_File='$Read_File',Download='$Download' where id_p = '$id_p';";
$result_update = mysql_query($sql_update) or die(mysql_error());
mysql_close();
if($result_update)
{
echo " <META HTTP-EQUIV='refresh' content='2;URL=index.php'>";
echo "<CENTER>Edit....Complete</CENTER>";
} else {
echo "database can't not connect";
}
?>
Tag : PHP, HTML/CSS, JavaScript
|
|
|
|
|
|
Date :
2011-03-25 10:07:13 |
By :
Tigerpol |
View :
1176 |
Reply :
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณมากคับ ที่นำมาแบ่งปัน
|
|
|
|
|
Date :
2011-03-25 10:35:33 |
By :
Tigerpol |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|