<html> <head> <title>ThaiCreate.Com Tutorial</title> </head> <body> <script language="javascript"> function fncSubmit() { var intChk = 0; for(i=1;i<=document.form1.hdnLine.value;i++) { if(eval("document.form1.chk"+i+".checked")==true) { intChk++; } } if(intChk != 5) { alert('Please checked 5 items.'); return false; } document.form1.submit(); } </script> <form action="page.cgi" method="post" name="form1" onSubmit="JavaScript:return fncSubmit();"> Checkbox 1 <input name="chk[]" type="checkbox" id="chk1" value="Y"><br> Checkbox 2 <input name="chk[]" type="checkbox" id="chk2" value="Y"><br> Checkbox 3 <input name="chk[]" type="checkbox" id="chk3" value="Y"><br> Checkbox 4 <input name="chk[]" type="checkbox" id="chk4" value="Y"><br> Checkbox 5 <input name="chk[]" type="checkbox" id="chk5" value="Y"><br> Checkbox 6 <input name="chk[]" type="checkbox" id="chk6" value="Y"><br> Checkbox 7 <input name="chk[]" type="checkbox" id="chk7" value="Y"><br> Checkbox 8 <input name="chk[]" type="checkbox" id="chk8" value="Y"><br> Checkbox 9 <input name="chk[]" type="checkbox" id="chk9" value="Y"><br> Checkbox 10 <input name="chk[]" type="checkbox" id="chk10" value="Y"><br> <input type="hidden" name="hdnLine" value="10"> <input name="btnSubmit" type="submit" value="Submit" > </form> </body> </html>
<? require("connect.inc.php"); $sql = "SELECT * FROM product ORDER BY pro_id ASC "; $query = mysql_query($sql) or die ("Error Query [".sql."]"); echo"<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\"><tr>"; $intRows = 0; while($result = mysql_fetch_array($query)) { $intRows++; echo "<td>"; ?> </p> <form id="form1" method="post" action="product_test.php"> <table width="91" border="0" cellspacing="8" cellpadding="0"> <tr> <td><div align="center"><img src="./admin/images/<?=$result["pro_pic"];?>" width="200" height="150" border="0"> </div></td> </tr> <tr><? echo $result ['pro_id']; ?> <td><div align="center"><?=$result["pro_name"];?> <input type="checkbox" name="checkbox" value="<? echo $result ['pro_id']; ?>" /> จอง <br /> จำนวน <strong>:</strong> <input type="text" name="amount" size="4" /><br /> </div></td> </tr> </table></form> <? echo"</td>"; if(($intRows)%3==0) { echo"</tr>"; } else { echo "<td>"; } } echo"</tr></table>"; ?> <form id="form1" method="post" action="product_test.php"> <table width="100%" border="0"> <tr> <td><div align="center"><input name="btnSubmit" type="submit" value="Submit" /></div></td> </tr> </table> </form> <? mysql_close($connect) or die (mysql_error); ?>
<html> <head> <title>ThaiCreate.Com PHP & MySQL Tutorial</title> </head> <body> <script language="JavaScript"> function onSave() { if(confirm('Do you want to save ?')==true) { return true; } else { return false; } } </script> <form name="frmMain" action="save.php" method="post" OnSubmit="return onSave();"> <? $objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database"); $objDB = mysql_select_db("mydatabase"); $strSQL = "SELECT * FROM customer"; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); ?> <table width="600" border="1"> <tr> <th width="91"> <div align="center">CustomerID </div></th> <th width="98"> <div align="center">Name </div></th> <th width="198"> <div align="center">Email </div></th> <th width="97"> <div align="center">CountryCode </div></th> <th width="59"> <div align="center">Budget </div></th> <th width="71"> <div align="center">Used </div></th> <th width="30"> <div align="center">Select </div></th> </tr> <? while($objResult = mysql_fetch_array($objQuery)) { ?> <tr> <td><div align="center"><?=$objResult["CustomerID"];?></div></td> <td><?=$objResult["Name"];?></td> <td><?=$objResult["Email"];?></td> <td><div align="center"><?=$objResult["CountryCode"];?></div></td> <td align="right"><?=$objResult["Budget"];?></td> <td align="right"><?=$objResult["Used"];?></td> <td align="center"><input type="checkbox" name="chkEmail[]" value="<?=$objResult["Email"];?>"></td> </tr> <? } ?> </table> <? mysql_close($objConnect); ?> <input type="submit" name="btnSave" value="Save"> </form> </body> </html>
<html> <head> <title>ThaiCreate.Com PHP & MySQL Tutorial</title> </head> <body> <? $objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database"); $objDB = mysql_select_db("mydatabase"); for($i=0;$i<count($_POST["chkEmail"]);$i++) { if($_POST["chkEmail"][$i] != "") { $strSQL = "INSERT INTO table_name (Mail) VALUES ('".$_POST["chkEmail"][$i]."')"; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); } } echo "Record Insert."; mysql_close($objConnect); ?> </body> </html>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง