<form action="" method="post" name="frmMain" id="frmMain"> <table border="0" align="center" cellpadding="0" cellspacing="0" id="id-form"> <tr> <th width="130" valign="top">เลขที่เอกสาร :</th> <td width="378"><input type="text" class="inp-form-error" name="txtid" /></td> <td width="187"> <div class="error-left"></div> <div class="error-inner">ข้อมูลสำคัญ ต้องกรอก!!!.</div> </td> </tr> <tr> <th valign="top">หัวข้อปัญหา :</th> <td><input type="text" class="inp-form" name="txttopic" /></td> <td></td> </tr> <tr> <th valign="top">รายละเอียด :</th> <td><textarea rows="" cols="" class="form-textarea" name="txtdetail"></textarea></td> <td></td> </tr> <tr> <th>ไฟล์เอกสาร :</th> <td><input type="file" class="file_1" name="faqUp" /></td> <td> <div class="bubble-left"></div> <div class="bubble-inner">PDF 5MB max per file</div> <div class="bubble-right"></div> </td> </tr> <th> </th> <td valign="top"> <input name="btnSubmit" type="button" class="form-submit" onClick="window.location='frmUploadFaq.php?Action=Save&id=<?=$_POST["txtid"]?>'" /> <input name="btnRst" type="button" class="form-reset" onClick="window.location='frmUploadFaq.php'" /> </td> <td></td> </tr> </table> </form>
<input name="btnSubmit" type="button" class="form-submit" onClick="window.location='frmUploadFaq.php?Action=Save&id=<?=$_POST["txtid"]?>'" />
<input name="btnSubmit" type="submit" class="form-submit" onClick="window.location='frmUploadFaq.php?Action=Save&id=<?=$_POST["txtid"]?>'" />
<? include_once 'include/functions.php'; if ($_REQUEST["Action"]=="Save") { $strSQL = "INSERT INTO tbfaq (faqID,faqTopic,faqUrl)VALUES('".$_REQUEST["txtid"]."','".$_REQUEST["txttopic"]."','".$_REQUEST["txtdetail"]."') "; $objQuery = mysql_query($strSQL); } ?> <form action="frmUploadFaq.php?Action=Save" method="post" name="form1"> <table border="0" align="center" cellpadding="0" cellspacing="0" id="id-form"> <tr> <th width="130" valign="top">เลขที่เอกสาร :</th> <td width="378"><input type="text" class="inp-form-error" name="txtid" /></td> <td width="187"> <div class="error-left"></div> <div class="error-inner">ข้อมูลสำคัญ ต้องกรอก!!!.</div> </td> </tr> <tr> <th valign="top">หัวข้อปัญหา :</th> <td><input type="text" class="inp-form" name="txttopic" /></td> <td></td> </tr> <tr> <th valign="top">รายละเอียด :</th> <td><textarea rows="" cols="" class="form-textarea" name="txtdetail"></textarea></td> <td></td> </tr> <tr> <th>ไฟล์เอกสาร :</th> <td><input type="file" class="file_1" name="faqUp" /></td> <td> <div class="bubble-left"></div> <div class="bubble-inner">PDF 5MB max per file</div> <div class="bubble-right"></div> </td> </tr> <th> </th> <td valign="top"> <input name="btnSubmit" type="submit" class="form-submit" /> <input name="btnRst" type="button" class="form-reset" onClick="window.location='frmUploadFaq.php'"/></td> <td></td> </tr> </table> </form>
<input type="button" id="btn" name="btn" value="Send data" OnClick="Javascript:window.location='page2.php?dat1=' // ตรงนี้เป็นการกำหนด event OnClick เพื่อให้เปิดไฟล์ที่ชื่อ page2.php + document.getElementById('dat1').value + '&dat2=' // เอาค่าจาก element โดยใช้ id = dat1 + document.getElementById('dat2').value "/> // เอาค่าจาก element โดยใช้ id = dat2
ที่ต้องทำความเข้าใจให้ดีก็คือ document.getElementById('dat2').value
<? include_once 'include/functions.php'; if ($_REQUEST["Action"]=="Save") { $strSQL = "INSERT INTO tbfaq (faqID,faqTopic,faqUrl)VALUES('".$_REQUEST["txtid"]."','".$_REQUEST["txttopic"]."','".$_REQUEST["txtdetail"]."') "; //$objQuery = mysql_query($strSQL); echo $strSQL; $fileuploadType= explode('.', $_FILES["fileUp"]["name"]); if($_FILES["fileUp"]["name"]!="" && $fileuploadType[1]=="pdf" && $_FILES["fileUp"]["size"] < 5242880 ){ $path = "pdf/"; //สร้าง folder สำหรับเก็บไฟล์ PDF $fileName = date('YmdHis'); $fileuploadName = $fileName.".".$fileuploadType[1]; $upFile = $path."".$fileuploadName; @copy($_FILES["fileUp"]["tmp_name"], $upFile); //echo $_FILES["fileUp"]["name"]; echo '<BR>created file in pdf folder name '.$fileuploadName; }else{ echo '<BR>Incorrect!! Type of file is '.$fileuploadType[1]; } } ?> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <form action="frmUploadFaq.php?Action=Save" method="post" name="form1" id="form1" enctype="multipart/form-data"> <table border="0" align="center" cellpadding="0" cellspacing="0" id="id-form"> <tr> <th width="130" valign="top">เลขที่เอกสาร :</th> <td width="378"><input type="text" class="inp-form-error" name="txtid" id="txtid"/></td> <td width="187"> <div class="error-left"></div> <div class="error-inner">ข้อมูลสำคัญ ต้องกรอก!!!.</div> </td> </tr> <tr> <th valign="top">หัวข้อปัญหา :</th> <td><input type="text" class="inp-form" name="txttopic" id="txttopic" /></td> <td></td> </tr> <tr> <th valign="top">รายละเอียด :</th> <td><textarea rows="" cols="" class="form-textarea" name="txtdetail" id="txtdetail" ></textarea></td> <td></td> </tr> <tr> <th>ไฟล์เอกสาร :</th> <td><input type="file" class="file_1" name="fileUp" id="fileUp" /></td> <td> <div class="bubble-left"></div> <div class="bubble-inner">PDF 5MB max per file</div> <div class="bubble-right"></div> </td> </tr> <th> </th> <td valign="top"> <input name="btnSubmit" type="submit" class="form-submit" value="submit" /> <input name="btnRst" type="button" class="form-reset" onClick="window.location='frmUploadFaq.php'"/></td> <td></td> </tr> </table> </form>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง