$a=.............................. //ตัวแปรใช้เก็บเลข 2553 $b=.............................. //ตัวแปรใช้เก็บเลข 2
<table width="670" border="0"> <tr> <td height="35"><center> <strong><font size="+1">ดึงข้อมูลจากไฟล์ Excel</font></strong> </center></td> </tr> <tr> <td><hr /></td> </tr> <tr> <td><center><input type="file" name="fileUpload"> <font color="#FF0000">*แนบไฟล์ .csv เท่านั้น</font> </center></td> </tr> <tr> <td bgcolor="#FFFFFF"><center><div id="idProcessing" style="width: 35%; left: 40%; top: 70%; height: 13%; font-size: 32px; display: none; z-index: 1; position: fixed; background-color:#FFF; color:#F00; padding: 10px 0; " > <span style="margin-left: 75px;">กรุณารอสักครู่ <img src="images/loading.gif"></span> <span id="idDotAdding"></span> </div> <input name="submit2" type="submit" value="ค้นหา" onclick="this.blur(); Processing(); return true;"/> <input name="submit3" type="reset" value="ยกเลิก" /></center></td> </tr> </table>
<html> <head> <title>ThaiCreate.Com Tutorial</title> </head> <body> <?php //echo "\$_FILES[\"fileUpload\"][\"name\"] = ".$_FILES["fileUpload"]["name"]."<br>"; //echo "\$_FILES[\"fileUpload\"][\"type\"] = ".$_FILES["fileUpload"]["type"]."<br>"; //echo "\$_FILES[\"fileUpload\"][\"size\"] = ".$_FILES["fileUpload"]["size"]."<br>"; //echo "\$_FILES[\"fileUpload\"][\"tmp_name\"] = ".$_FILES["fileUpload"]["tmp_name"]."<br>"; //echo "\$_FILES[\"fileUpload\"][\"error\"] = ".$_FILES["fileUpload"]["error"]."<br>"; if(move_uploaded_file($_FILES["fileUpload"]["tmp_name"],"".$_FILES["fileUpload"]["name"])) // Upload/Copy { echo "Copy/Upload Complete."; ?> <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> </tr> <? $objCSV = fopen("customer.csv", "r"); while (($objArr = fgetcsv($objCSV, 1000, ",")) !== FALSE) { ?> <tr> <td><div align="center"><?=$objArr[0];?></div></td> <td><?=$objArr[1];?></td> <td><?=$objArr[2];?></td> <td><div align="center"><?=$objArr[3];?></div></td> <td align="right"><?=$objArr[4];?></td> <td align="right"><?=$objArr[5];?></td> </tr> <? } fclose($objCSV); ?> </table> <? } ?> </body> </html>
echo $objArr[1]; //ตัวแปรอาร์เรย์ที่กำหนดช่องที่ต้องการให้เเสดงข้อมูลในช่องนั้นในไฟล์ excel
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง