|
|
|
เพิ่มรูปลงไปในฟิลด์โดยใช้ Checkbox เป็นตัวกำหนดตำแหน่งยังไงครับ |
|
|
|
|
|
|
|
ช่วยทีครับ
Code (PHP)
<?php
if(move_uploaded_file($_FILES["filUpload"]["img_com"],"myfile/".$_FILES["filUpload"]["name"]))
{
echo "Copy/Upload Complete<br>";
//*** Insert Record ***//
$objConnect = mysql_connect("localhost","root","12345678") or die("Error Connect to Database");
$objDB = mysql_select_db("project");
$strSQL = "INSERT INTO tb_table";
$strSQL ="(c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13) VALUES ('".$_FILES["filUpload"]["name"]."')";
$objQuery = mysql_query($strSQL);
}
?>
<form action="" method="post" enctype="multipart/form-data" name="form1" id="form1">
<p>
<input type="file" name="filUpload" id="filUpload" />
</p>
<p>
<label>
<input type="checkbox" name="ck[]" value="" id="ck_0" />
c1</label>
<label>
<input type="checkbox" name="ck[]" value="checkbox" id="ck_1" />
c2</label>
<label>
<input type="checkbox" name="ck[]" value="checkbox" id="ck_2" />
c3</label>
<label>
<input type="checkbox" name="ck[]" value="checkbox" id="ck_3" />
c4</label>
<label>
<input type="checkbox" name="ck[]" value="checkbox" id="ck_4" />
c5</label>
<label>
<input type="checkbox" name="ck[]" value="checkbox" id="ck_5" />
c6</label>
<label>
<input type="checkbox" name="ck[]" value="checkbox" id="ck_6" />
c7</label>
<label>
<input type="checkbox" name="ck[]" value="checkbox" id="ck_7" />
c8</label>
<label>
<input type="checkbox" name="ck[]" value="checkbox" id="ck_8" />
c9</label>
<label>
<input type="checkbox" name="ck[]" value="checkbox" id="ck_9" />
c10</label>
<label>
<input type="checkbox" name="ck[]" value="checkbox" id="ck_10" />
c11</label>
<label>
<input type="checkbox" name="ck[]" value="checkbox" id="ck_11" />
c12</label>
<label>
<input type="checkbox" name="ck[]" value="checkbox" id="ck_12" />
c13</label>
</p>
<p>
<input type="submit" name="button" id="button" value="ตกลง" />
</p>
<p>
<?php
$objConnect = mysql_connect("localhost","root","12345678") or die("Error Connect to Database");
$objDB = mysql_select_db("project");
$strSQL = "SELECT * FROM tb_table";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<table width="340" border="1">
<tr>
<th> <div align="center">c1</div></th>
<th> <div align="center">c2</div></th>
<th> <div align="center">c3</div></th>
<th> <div align="center">c4</div></th>
<th> <div align="center">c5</div></th>
<th> <div align="center">c6</div></th>
<th> <div align="center">c7</div></th>
<th> <div align="center">c8</div></th>
<th> <div align="center">c9</div></th>
<th> <div align="center">c10</div></th>
<th> <div align="center">c11</div></th>
<th> <div align="center">c12</div></th>
<th> <div align="center">c13</div></th>
</tr>
<?php
while($objResult = mysql_fetch_array($objQuery))
{
?>
<tr>
<td><center><img src="myfile/<?php echo $objResult["FilesName"];?>"></center></td>
<td><center><img src="myfile/<?php echo $objResult["FilesName"];?>"></center></td>
<td><center><img src="myfile/<?php echo $objResult["FilesName"];?>"></center></td>
<td><center><img src="myfile/<?php echo $objResult["FilesName"];?>"></center></td>
<td><center><img src="myfile/<?php echo $objResult["FilesName"];?>"></center></td>
<td><center><img src="myfile/<?php echo $objResult["FilesName"];?>"></center></td>
<td><center><img src="myfile/<?php echo $objResult["FilesName"];?>"></center></td>
<td><center><img src="myfile/<?php echo $objResult["FilesName"];?>"></center></td>
<td><center><img src="myfile/<?php echo $objResult["FilesName"];?>"></center></td>
<td><center><img src="myfile/<?php echo $objResult["FilesName"];?>"></center></td>
<td><center><img src="myfile/<?php echo $objResult["FilesName"];?>"></center></td>
<td><center><img src="myfile/<?php echo $objResult["FilesName"];?>"></center></td>
<td><center><img src="myfile/<?php echo $objResult["FilesName"];?>"></center></td>
</tr>
<?php
}
?>
</table>
<?php
mysql_close($objConnect);
?></p>
</form>
Tag : PHP
|
ประวัติการแก้ไข 2018-08-04 14:17:18
|
|
|
|
|
Date :
2018-08-04 14:15:46 |
By :
Beginner |
View :
572 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ถ้ามีข้อมูล Index เดียวกัน ไม่สามารถใช้แบบ Array ได้ครับ name="ck[]" ให้ใช้เป็นแบบ ck1...ck2...ckk3...
|
|
|
|
|
Date :
2018-08-07 16:19:47 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|