<?php include "../connect.php"; include_once "../function/chk_login.php"; $product_id = $_GET["product_id"]; //================= ลบข้อมูล ===========================// if($_GET['action'] == "delete") { $del = mysql_query("DELETE FROM tb_productpic WHERE productpic_id='".$_GET["productpic_id"]."'"); if(!del) { echo mysql_error(); } else { echo"<script language='JavaScript'>"; echo"alert('ข้อมูลถูกลบแล้ว');"; echo"window.location='productpic.php?product_id=$_GET[product_id]';"; echo"</script>"; } } ?> <html> <head> </head> <body> <div style="margin-bottom:20px;"><strong class="HeaderText">เพิ่ม-แก้ไข รายละเอียดรูป</strong></div> <form name="form" method="post" action="productpic_save.php?product_id=<?php echo $r["product_id"]; ?>" enctype="multipart/form-data" onSubmit="JavaScript:return submit_productpic();"> <div style="width:500px; height:120px;" class="BodyStyle"> <div class="space" style="width:100px; float:left; text-align:left;"><strong>ชื่อรูป</strong></div> <div class="space" style="width:400px; float:left; text-align:left;"> <input type="file" name="productpic_shot" value="<?php echo $r["productpic_shot"]; ?>" size="60"> </div> <div style=" margin:0 auto;"> <input type="image" name="submit" value="บันทึก" src="../images/button_submit.png"/></div> <input type="hidden" name="product_id" value="<?php echo $r["product_id"];?>" > </div> </div> </form> <?php include_once "../function/paging.php"; $sql = "select * from tb_productpic Where product_id = $_GET[product_id]"; $rs = mysql_query($sql); ?> <div style="margin-bottom:20px;"><strong class="HeaderText">รายละเอียดรูปภาพ</strong></div> <div class="clear"></div> <?php if ($rs): ?> <?php while ($r = mysql_fetch_array($rs)): ?> <div style="width:650px; margin:0 auto;" class="BodyStyle clear" align="center"> <div style="float:left; width:14px; height:86px; background-image:url(../images/admin/admin_head_bar_04.png); background-repeat:repeat-y;"></div> <div style="float:left; width:410px; height:80px; text-align:left;" class="border_data border_color_right"><img src="../picture/<?=$r["productpic_shot"];?>" style="width:70px; height:70px;"> <?php echo $r["productpic_shot"];?></div> <div style="width:30px; height:80px;" class="border_data"><a href="productpic.php?productpic_id=<?php echo $r["productpic_id"]; ?>&action=delete" onClick="return confirm('ยืนยันการลบ')"><img src="../images/delete.png" border="0"></a></div> <div style="float:left; height:86px; width:14px; background-image:url(../images/admin/admin_head_bar_06.png); background-repeat:repeat-y;"></div> </div> <?php Endwhile ?> <?php Endif ?> <?php include_once "../mysql_close.php"; ?> </body> </html>
<?php include "../connect.php"; include_once "../function/chk_login.php"; if(count($_REQUEST)){ print_r($_REQUEST); exit; } $product_id = $_REQUEST["product_id"]; //================= ลบข้อมูล ===========================// if($_REQUEST['action'] == "delete") { $del = mysql_query("DELETE FROM tb_productpic WHERE productpic_id='".$_REQUEST["productpic_id"]."'"); if(!del) { echo mysql_error(); } else { echo"<script language='JavaScript'>"; echo"alert('ข้อมูลถูกลบแล้ว');"; echo"window.location='productpic.php?product_id=$_REQUEST[product_id]';"; echo"</script>"; } } ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="../css/admin.css" /> <!--------------- เช็ค Error ช่องว่าง ------------------> <script type="text/javascript" src="../js/error_submit.js"></script> <script language="javascript"> submit_productpic() </script> </head> <body> <div style="margin-bottom:20px;"><strong class="HeaderText">เพิ่ม-แก้ไข รายละเอียดรูป</strong></div> <form name="form" method="post" action="productpic_save.php?product_id=<?php echo $r["product_id"]; ?>" enctype="multipart/form-data" onSubmit="JavaScript:return submit_productpic();"> <div style="width:500px; height:120px;" class="BodyStyle"> <div class="space" style="width:100px; float:left; text-align:left;"><strong>ชื่อรูป</strong></div> <div class="space" style="width:400px; float:left; text-align:left;"> <input type="file" name="productpic_shot" value="<?php echo $r["productpic_shot"]; ?>" size="60"> </div> <div style=" margin:0 auto;"> <input type="image" name="submit" value="บันทึก" src="../images/button_submit.png"/></div> <input type="hidden" name="product_id" value="<?php echo $r["product_id"];?>" > </div> </div> </form> <?php include_once "../function/paging.php"; $sql = "select * from tb_productpic Where product_id = $_REQUEST[product_id]"; $rs = mysql_query($sql); ?> <div style="margin-bottom:20px;"><strong class="HeaderText">รายละเอียดรูปภาพ</strong></div> <!-------- หัวข้อ -------> <div style="width:650px; margin:0 auto;" class="BodyStyle" align="center"> <div style="float:left; height:46px;"><img src="../images/admin/admin_head_bar_01.png" /></div> <div style="float:left; width:415px; height:46px;" align="center" class="border_data_head border_color_right"><strong><br /> รูปภาพ</strong></div> <div style="float:left; width:35px; height:46px;" align="center" class="border_data_head"><strong><br /> ลบ</strong></div> <div style="float:left; height:46px;"><img src="../images/admin/admin_head_bar_03.png" /></div> </div> <div class="clear"></div> <!-------- รายละเอียด ----------> <div class="clear"></div> <?php if ($rs): ?> <?php while ($r = mysql_fetch_array($rs)): ?> <div style="width:650px; margin:0 auto;" class="BodyStyle clear" align="center"> <div style="float:left; width:14px; height:86px; background-image:url(../images/admin/admin_head_bar_04.png); background-repeat:repeat-y;"></div> <div style="float:left; width:410px; height:80px; text-align:left;" class="border_data border_color_right"><img src="../picture/<?=$r["productpic_shot"];?>" style="width:70px; height:70px;"> <?php echo $r["productpic_shot"];?></div> <div style="width:30px; height:80px;" class="border_data"><a href="productpic.php?productpic_id=<?php echo $r["productpic_id"]; ?>&action=delete" onClick="return confirm('ยืนยันการลบ')"><img src="../images/delete.png" border="0"></a></div> <div style="float:left; height:86px; width:14px; background-image:url(../images/admin/admin_head_bar_06.png); background-repeat:repeat-y;"></div> </div> <?php Endwhile ?> <?php Endif ?> <!------------------- ส่วนด้านล่าง --------------------> <div style="width:650px; margin:0 auto;" class="BodyStyle clear" align="center"> <div style="float:left;"><img src="../images/admin/admin_head_bar_07.png" /></div> <div style="width:410px; height:4px; text-align:left;" class="border_data border_color_footer"></div> <div style="width:30px; height:4px; border-bottom:2px solid #000000;" class="border_data"></div> <div style="float:left;"><img src="../images/admin/admin_head_bar_09.png" /></div> </div> <!--------------------------------------------------> <?php include_once "../mysql_close.php"; ?> </body> </html>
<div style="width:30px; height:80px;" class="border_data"> <img src="../images/delete.png" border="0" onclick="if(confirm('ยืนยันการลบ')) location.href='productpic.php?productpic_id=<?=$r["productpic_id"]?>&action=delete';"> </div>
<?php include "../connect.php"; include_once "../function/chk_login.php"; $default_product_id=''; // ในกรณีที่ไม่ได้มีการส่งค่า product_id จะให้ค่า default เป็นอะไร $product_id = isset($_REQUEST["product_id"])? $_REQUEST["product_id"] : $default_product_id; //================= ลบข้อมูล ===========================// if(isset($_REQUEST['action']) && $_REQUEST['action']== "delete") { mysql_query( $qr="DELETE FROM tb_productpic WHERE productpic_id='$_REQUEST[productpic_id]' " ); if(mysql_errno()) { echo $qr, "<br />\n", mysql_error(); exit; }else { echo"<script language='JavaScript'>"; echo"alert('ข้อมูลถูกลบแล้ว');"; echo"location.href='productpic.php?product_id=$product_id';"; echo"</script>"; exit; } } //================= end ลบข้อมูล ===========================// ?><!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="../css/admin.css" /> <!--------------- เช็ค Error ช่องว่าง ------------------> </head> <body> <script type="text/javascript" src="../js/error_submit.js"></script> <script language="javascript"> submit_productpic(); // คำสั่งตรงนี้ทำอะไร </script> <div style="margin-bottom:20px;"><strong class="HeaderText">เพิ่ม-แก้ไข รายละเอียดรูป</strong></div> <form name="form" method="post" action="productpic_save.php" enctype="multipart/form-data" onSubmit="JavaScript:return submit_productpic();"> <input type="hidden" name="product_id" value="<?=$product_id?>" /> <div style="width:500px; height:120px;" class="BodyStyle"> <div class="space" style="width:100px; float:left; text-align:left;"><strong>ชื่อรูป</strong></div> <div class="space" style="width:400px; float:left; text-align:left;"><input type="file" name="productpic_shot" size="60" ></div> <div style=" margin:0 auto;"> <input type="image" name="submit" value="บันทึก" src="../images/button_submit.png" onclick="this.form.submit();" /></div> </div> </form> <?php include_once "../function/paging.php"; $sql = "select * from tb_productpic Where product_id = $product_id"; $rs = mysql_query($sql); ?> <div style="margin-bottom:20px;"><strong class="HeaderText">รายละเอียดรูปภาพ</strong></div> <!-------- หัวข้อ -------> <div style="width:650px; margin:0 auto;" class="BodyStyle" align="center"> <div style="float:left; height:46px;"><img src="../images/admin/admin_head_bar_01.png" /></div> <div style="float:left; width:415px; height:46px;" align="center" class="border_data_head border_color_right"><strong><br /> รูปภาพ</strong></div> <div style="float:left; width:35px; height:46px;" align="center" class="border_data_head"><strong><br /> ลบ</strong></div> <div style="float:left; height:46px;"><img src="../images/admin/admin_head_bar_03.png" /></div> </div> <div class="clear"></div> <!-------- รายละเอียด ----------> <div class="clear"></div> <?php if ($rs): ?> <?php while ($r = mysql_fetch_array($rs)): ?> <div style="width:650px; margin:0 auto;" class="BodyStyle clear" align="center"> <div style="float:left; width:14px; height:86px; background-image:url(../images/admin/admin_head_bar_04.png); background-repeat:repeat-y;"></div> <div style="float:left; width:410px; height:80px; text-align:left;" class="border_data border_color_right"> <img src="../picture/<?=$r["productpic_shot"];?>" style="width:70px; height:70px;"> <?=$r["productpic_shot"]?></div> <div style="width:30px; height:80px;" class="border_data"><img src="../images/delete.png" border="0" onClick="if(confirm('ยืนยันการลบ')) location.href='productpic.php?product_id=<?=$product_id?>&productpic_id=<?=$r["productpic_id"] ?>&action=delete'; "><!-- เพิ่ม parameter product_id เดิมไม่มีครับ --> </div> <div style="float:left; height:86px; width:14px; background-image:url(../images/admin/admin_head_bar_06.png); background-repeat:repeat-y;"></div> </div> <?php Endwhile ?> <?php Endif ?> <!------------------- ส่วนด้านล่าง --------------------> <div style="width:650px; margin:0 auto;" class="BodyStyle clear" align="center"> <div style="float:left;"><img src="../images/admin/admin_head_bar_07.png" /></div> <div style="width:410px; height:4px; text-align:left;" class="border_data border_color_footer"></div> <div style="width:30px; height:4px; border-bottom:2px solid #000000;" class="border_data"></div> <div style="float:left;"><img src="../images/admin/admin_head_bar_09.png" /></div> </div> <!--------------------------------------------------> <?php include_once "../mysql_close.php"; ?> </body> </html>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง