<html> <?php include "config.inc.php"; $con = mysql_connect($host,$username,$password); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db($database, $con); ?> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!--ส่วน JS --> <link rel="stylesheet" media="all" type="text/css" href="js/jquerydatepicker/jquery-ui.css" /> <link rel="stylesheet" media="all" type="text/css" href="js/jquerydatepicker/jquery-ui-timepicker-addon.css" /> <script type="text/javascript" src="js/jquerydatepicker/jquery-1.10.2.min.js"></script> <script type="text/javascript" src="js/jquerydatepicker/jquery-ui.min.js"></script> <script type="text/javascript" src="js/jquerydatepicker/jquery-ui-timepicker-addon.js"></script> <script type="text/javascript" src="js/jquerydatepicker/jquery-ui-sliderAccess.js"></script> <!--ส่วน Body --> <script language="JavaScript"> function check_reg(){ ///ตรงนี้แหละครับที่มีปัญหา if(document.form_reg.name_pro.value==""){ alert("กรุณากรอก ชื่อสินค้า ด้วยครับ"); document.form_reg.name_pro.focus(); return false; } if(document.form_reg.date_in.value==""){ alert("กรุณากรอก วันที่รับ ด้วยครับ"); document.form_reg.date_in.focus(); return false; } if(document.form_reg.price_unit.value==""){ alert("กรุณากรอก รายละเอียดกิจกรรม ด้วยครับ"); document.form_reg.price_unit.focus(); return false; } if(document.form_reg.product_on_hand.value==""){ alert("กรุณากรอก จำนวนสินค้าที่มีในสต็อก ด้วยครับ"); document.form_reg.product_on_hand.focus(); return false; } if(document.form_reg.amount_received.value==""){ alert("กรุณากรอก จำนวนสินค้าที่ได้รับ ด้วยครับ"); document.form_reg.amount_received.focus(); return false; } if(document.form_reg.total_cost.value==""){ alert("กรุณากรอก จำนวนสินค้าที่ได้รับ ด้วยครับ"); document.form_reg.total_cost.focus(); return false; } if(document.from_reg.totla_cost.value==""){ alert("กรุณากรอก จำนวนสินค้าที่ได้รับ"); document.from_reg.total_cost.focus(); return false; } } function chkConfirm() {if(confirm('คุณแน่ใจใช่หรือไม่ที่จะลบข้อมูลนี้')){ return true; }else{ return false; } } $(function(){ $("#date_in").datepicker({ dateFormat: 'yy-mm-dd', numberOfMonths: 2, }); }); </script> <body> <fieldset> <legend>เพิ่มสินค้า</legend> <table width="641" align="center"> <form action="product_insert.php" method="post" enctype="multipart/form-data name="form_reg="form_reg"" id="form_reg" onsubmit="return check_reg()"> <tr> <td width="128">ชื่อสินค้า</td> <td width="283"><label for="name_pro"></label> <input type="text" name="name_pro" id="name_pro" /></td> </tr> <tr> <td>วันที่นำเข้าสินค้า</td> <td><div id="startDate"> <input type="text" name="date_in" id="date_in" value="" /> </div></td> </tr> <tr> <td>ราคาต่อหน่วย</td> <td><input type="text" name="price_unit" id="price_unit" /></td> </tr> <tr> <td>จำนวนสินค้าที่มีอยู่</td> <td><input type="text" name="product_on_hand" id="product_on_hand" /></td> </tr> <tr> <td>จำนวนที่ได้รับ</td> <td><input type="text" name="amount_received" id="amount_received" /></td> </tr> <tr> <td>ต้นทุนรวม</td> <td><label for="total_cost"></label> <input type="text" name="total_cost" id="total_cost" /></td> </tr> <tr> <td>รูปสินค้า</td> <td><input type="file" name="product_img" id="product_img" /></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td colspan="2"><input type="submit" value="เพิ่มสินค้า" /> <input type="reset" value=" ยกเลิก" /></td> </tr> </form> </table> <p> </p> </fieldset> <br /><br /> <br /> <center><? $con = mysql_connect($host,$username,$password); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db($database, $con); $sql = "select * FROM products"; $result = mysql_query($sql); echo "<table border='1'> <tr> <th>ชื่อสินค้า</th> <th>วันที่นำเข้าสินค้า</th> <th>ราคาต่อหน่วย</th> <th>จำนวนสินค้าที่มีอยู่</th> <th>จำนวนที่ได้รับ</th> <th>ต้นทุนรวม</th> <th>รูปสินค้า</th> <th></th> <th></th> </tr>"; while($row = mysql_fetch_array($result)) { $id=$row['id_pro']; echo "<tr>"; echo "<td>" . $row['name_pro'] . "</td>"; echo "<td>" . $row['date_in'] . "</td>"; echo "<td>" . $row['price_unit'] . "</td>"; echo "<td>" . $row['product_on_hand'] . "</td>"; echo "<td>" . $row['amount_received'] . "</td>"; echo "<td>" . $row['product_on_hand'] . "</td>"; echo "<td>" . $row['total_cost'] . "</td>"; echo "<td> <a href='product_edit.php?id=".$id."'>แก้ไข</a>"."</td>"; echo "<td> <a href='product_delete.php?id=".$id."' onclick='return chkConfirm();'>ลบ</a>"."</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?> </body> </html>
<form action="product_insert.php" method="post" enctype="multipart/form-data name="form_reg="form_reg"" id="form_reg" onsubmit="return check_reg()">
<form action="product_insert.php" method="post" enctype="multipart/form-data" name="form_reg="form_reg"" id="form_reg" onsubmit="return check_reg()">
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง