<?php include "connect.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> <!-- .style10 {font-family: Tahoma; color: #000000; font-size: 18; font-weight: bold; } --> </style> </head> <script language="javascript"> function checkform() { if(form1.title.value=="" ) { alert ('ยังไม่ได้กรอกชื่อเนื้อหาเสริม'); form1.title.focus(); return false; } else if(form1.des.value=="" ) { alert ('ยังไม่ได้กรอกคำอธิบาย'); form1.des.focus(); return false; } else if ( document.getElementById('fileUpload').value.length == 0 ) { alert( 'ยังไม่ได้ระบุไฟล์ที่จะอัพโหลด' ) ; form1.fileUpload.focus(); return false ; } } </script> <body> <center><img src="images/addAdd.jpg" width="150" height="105" /><br /><br /> <img src="images/12852_76754.gif" /> </center> <? //$chap_id = $_GET['chap_id']; $j=0; $sql = "select chap_id from addition"; $db_query = mysql_query($sql) or die ("Error: $sql"); while($result = mysql_fetch_array($db_query)) { $x[j] = $result["chap_id"]; $j++; } for ($i=1;$i<=15;$i++) { $flag = true; $k=0; while($k<=$j-1 && $flag) { if ($i == $x[k]) // นี่คือ line 59 ที่มันฟ้อง error ค่ะ { $flag = false; } } //if ($flag) //{ //} } ?> <form id="form1" name="form1" method="post" action="addAddition2.php" enctype = "multipart/form-data" onsubmit="return checkform();"> <table width="550" border="0" align="center"> <tr> <td bgcolor="#0066CC"><strong>บทที่</strong></td> <td bgcolor="#66CCFF"><label> <select name="select"> <? if($flag){?><option>$i;</option><? } ?> </select> </label></td> </tr> <tr> <td width="40%" bgcolor="#0066CC"><span class="style10">ชื่อเนื้อหาเสริม</span></td> <td width="60" bgcolor="#66CCFF"><input name="title" type="text" value="" size="50" /></td> </tr> <tr> <td width="40%" bgcolor="#0066CC" ><span class="style10">คำอธิบาย</span></td> <td bgcolor="#66CCFF" width="60"> <textarea name="des" cols="47" rows="3" id="des"></textarea> </td> </tr> <tr> <td width="40%" bgcolor="#0066CC" ><span class="style10">ประเภท</span></td> <td bgcolor="#66CCFF" width="60"> <select name="selectType" id="selectType"> <option value="1" selected="selected">.doc</option> <option value="2">.PDF</option> </select> </td> </tr> <tr> <td width="40%" bgcolor="#0066CC" ><span class="style10">เลือกไฟล์เนื้อหาเสริมใหม่</span></td> <td bgcolor="#66CCFF" width="60"><input name="fileUpload" type="file" id="fileUpload" value="" /></td> </tr> <tr bgcolor="#000033"> <td colspan="2" bgcolor="#000033"><div align="center" class="style10"> <input type="submit" name="Submit" value=" เพิ่ม " /> <input type="reset" name="Reset" value="ยกเลิก" onClick="history.back();"/> </div></td> </tr> </table> </form> </body> </html> <? mysql_close(); ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง