<? include('config.inc.php'); //*** Update Condition ***// if($_GET["Action"] == "Save") { for($i=1;$i<=$_POST["hdnLine"];$i++) { $strSQL = "UPDATE testing SET "; $strSQL .="question = '".$_POST["txtCustomerID$i"]."' "; $strSQL .=",c1 = '".$_POST["txtName$i"]."' "; $strSQL .=",c2 = '".$_POST["txtEmail$i"]."' "; $strSQL .=",c3 = '".$_POST["txtCountryCode$i"]."' "; $strSQL .=",c4 = '".$_POST["txtBudget$i"]."' "; $strSQL .=",answer = '".$_POST["txtUsed$i"]."' "; $strSQL .="WHERE question = '".$_POST["hdnCustomerID$i"]."' "; $objQuery = mysql_query($strSQL); } //header("location:$_SERVER[PHP_SELF]"); //exit(); } ?> <? $strSQL = "SELECT * FROM testing"; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); ?> <form action="test_edit.php?Action=Save" method="post" enctype="multipart/form-data" name="frmMain"> <table width="627" border="1" align="center"> <tr> <th width="261" height="24" bgcolor="#99CC66"> <div align="center" class="style1"> <div align="left">คำถาม</div> </div></th> <th width="68" bgcolor="#99CC66"> <div align="center" class="style1"> <div align="center">รูปภาพ</div> </div></th> <th width="55" bgcolor="#99CC66"> <div align="center" class="style1"> <div align="center">ตัวเลือกที่ 1</div> </div></th> <th width="55" bgcolor="#99CC66"> <div align="center" class="style1"> <div align="center">ตัวเลือกที่ 2 </div> </div></th> <th width="55" bgcolor="#99CC66"> <div align="center" class="style1"> <div align="center">ตัวเลือกที่ 3 </div> </div></th> <th width="55" bgcolor="#99CC66"> <div align="center" class="style1"> <div align="center">ตัวเลือกที่ 4 </div> </div></th> <th width="32" bgcolor="#99CC66"> <div align="center" class="style1"> <div align="center">เฉลย </div> </div></th> </tr> <? $i =0; while($objResult = mysql_fetch_array($objQuery)) { $i = $i + 1; ?> <tr> <td> <div align="left"> <input type="hidden" name="hdnCustomerID<?=$i;?>" size="5" value="<?=$objResult["question"];?>"> <input type="text" name="txtCustomerID<?=$i;?>" size="40" value="<?=$objResult["question"];?>"> <br> </div></td> <td><img src="img_ex/<?=$objResult["pic"];?>" width="50" height="50" /><input type="file" name="filUpload" ></td> <td> <div align="left"> <input type="text" name="txtName<?=$i;?>" size="5" value="<?=$objResult["c1"];?>"> </div></td> <td> <div align="left"> <input type="text" name="txtEmail<?=$i;?>" size="5" value="<?=$objResult["c2"];?>"> </div></td> <td> <div align="left"> <input type="text" name="txtCountryCode<?=$i;?>" size="5" value="<?=$objResult["c3"];?>"> </div></td> <td> <div align="left"> <input type="text" name="txtBudget<?=$i;?>" size="5" value="<?=$objResult["c4"];?>"> </div></td><td><div align="center"> <input type="text" name="txtUsed<?=$i;?>" size="5" value="<?=$objResult["answer"];?>"> </div></td> </tr> <? } ?> </table>
if($_GET["Action"] == "Save") { for($i=1;$i<=$_POST["hdnLine"];$i++) { $strSQL = "UPDATE testing SET "; $strSQL .="question = '".$_POST["txtCustomerID$i"]."' "; $strSQL .=",c1 = '".$_POST["txtName$i"]."' "; $strSQL .=",c2 = '".$_POST["txtEmail$i"]."' "; $strSQL .=",c3 = '".$_POST["txtCountryCode$i"]."' "; $strSQL .=",c4 = '".$_POST["txtBudget$i"]."' "; $strSQL .=",answer = '".$_POST["txtUsed$i"]."' "; $strSQL .="WHERE question = '".$_POST["hdnCustomerID$i"]."' "; $objQuery = mysql_query($strSQL); } //header("location:$_SERVER[PHP_SELF]"); //exit(); }
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง