<?php //session_start(); //session_destroy(); ?><html> <head> <title>ThaiCreate.Com</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <?php mysql_connect("localhost","bpworld_root","root"); mysql_select_db("opencart"); $strSQL = "SELECT * FROM product"; $objQuery = mysql_query($strSQL) or die(mysql_error()); ?> <script language="javascript"> function fncSubmit() { if(document.form1.txt1.value < document.form1.txtQty.value ) { alert('จำนวนสินค้าไม่เพียงพอ'); document.form1.txtQty.focus(); return false; } if(document.form1.txt2.value == "") { alert('Please input Input 2'); document.form1.txt2.focus(); return false; } document.form1.submit(); } </script> <table width="555" border="1"> <tr> <td width="101">Picture</td> <td width="101">ProductID</td> <td width="82">ProductName</td> <td width="50">Price</td> <td width="50">Qty</td> <td width="100">Cart</td> </tr> <?php while($objResult = mysql_fetch_array($objQuery)) { ?> <tr> <form action="order.php" method="post" name="form1" onSubmit="JavaScript:return fncSubmit();"> <td><img src="img/<?php echo $objResult["Picture"];?>"></td> <td><?php echo $objResult["ProductID"];?></td> <td><?php echo $objResult["ProductName"];?></td> <td><?php echo $objResult["Price"];?></td> <td><input name="txt1" type="text" value="<?php echo $objResult["qty"];?>" size="4"></td> <td><input type="hidden" name="txtProductID" value="<?php echo $objResult["ProductID"];?>" size="2"> <select name="txtQty"> <?php for($qty=1;$qty<=20;$qty++) { ?> <option value="<?php echo $qty;?>"><?php echo $qty;?></option> <?php } ?> </select> <input name="btnSubmit1" type="submit" value="Add"> </td> </form> </tr> <?php } ?> </table> <br><br><a href="show.php">View Cart</a> | <a href="clear.php">Clear Cart</a> <?php mysql_close(); ?> </body> </html> <?php /* This code download from www.ThaiCreate.Com */ ?>
if( '1' < '02') alert('compare with number'); else alert('compare with text'); if( 1 < 02 ) alert('compare with number'); else alert('compare with text');
if(parseInt(document.form1.txt1.value) < parseInt(document.form1.txtQty.value))
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง