|
 |
|
จาก code ตัวอย่างผมจะทำให้มันเลือก Edit โดยใช้ Checkbox ได้ยังไงครับช่วยแนะนำหน่อยครับ |
|
 |
|
|
 |
 |
|
Code (PHP)
<td align="right"><input type="checkbox" name="chkOK<?=$i;?>" size="5" value="1" <?if($objResult["OK"]==1){echo "checked";}?>></td>
ตอน Save
Code (PHP)
//*** Update Condition ***//
if($_GET["Action"] == "Save")
{
for($i=1;$i<=$_POST["hdnLine"];$i++)
{
if($_POST["chkOK$i"] != "")
{
$strOK = "1";
}
else
{
$strOK = "0";
}
$strSQL = "UPDATE customer SET ";
$strSQL .="CustomerID = '".$_POST["txtCustomerID$i"]."' ";
$strSQL .=",Name = '".$_POST["txtName$i"]."' ";
$strSQL .=",Email = '".$_POST["txtEmail$i"]."' ";
$strSQL .=",CountryCode = '".$_POST["txtCountryCode$i"]."' ";
$strSQL .=",Budget = '".$_POST["txtBudget$i"]."' ";
$strSQL .=",Used = '".$_POST["txtUsed$i"]."' ";
$strSQL .=",OK = '".$strOK."' ";
$strSQL .="WHERE CustomerID = '".$_POST["hdnCustomerID$i"]."' ";
$objQuery = mysql_query($strSQL);
}
//header("location:$_SERVER[PHP_SELF]");
//exit();
}
|
 |
 |
 |
 |
Date :
2013-04-05 12:31:58 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณครับเดี๋ยวจะลองดู
|
 |
 |
 |
 |
Date :
2013-04-05 12:56:42 |
By :
joehawe |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ช่วยดูโค้ดให้ทีซิคับ ว่าจะให้ ช่อง checkbook มันดึงข้อมูลจากฐานข้อมูลมาเเสดงอย่างไร
Code (PHP)
<td height="34"> <input name="departments[]" type="checkbox" class="my_chk_css" id="chk1" value="ฝ่ายบริหาร" />
ฝ่ายบริหาร</td>
<td height="34"><input name="departments[]" type="checkbox" class="my_chk_css" id="chk2" value="ฝ่ายกิจการนักศึกษา" />
ฝ่ายกิจการนักศึกษา</td>
</tr>
<tr>
<td height="34"><input name="departments[]" type="checkbox" class="my_chk_css" id="chk3" value="ฝ่ายวางแผน" />
ฝ่ายวางแผน</td>
<td height="34"><input name="departments[]" type="checkbox" class="my_chk_css" id="chk4" value="ฝ่ายวิชาการนักศึกษา" />
ฝ่ายวิชาการนักศึกษา</td>
<tr>
<td height="34"><input name="departments[]" type="checkbox" class="my_chk_css" id="chk5" value="ฝ่ายพัสดุ" />
ฝ่ายพัสดุ</td>
โค้ดตอน save
Code (PHP)
if($_FILES["filUpload"]["name"] != "")
{
if(move_uploaded_file($_FILES["filUpload"]["tmp_name"],"myfile/".$_FILES["filUpload"]["name"]))
{
//*** Delete Old File ***//
@unlink("myfile/".$_POST["hdnOldFile"]);
$merged = "";
foreach($_POST["departments"] as $data){
$merged .= "$data-";
}
$merged = substr($merged ,0 , -1); //เพื่อตัด '-' ตัวสุดท้ายออกไป
$strSQL = "UPDATE tb_document SET ";
$strSQL .=",departments = '".$_POST["merged"]."' ";
$strSQL .="WHERE id_doc = '".$_GET["id_doc"]."' ";
$objQuery = mysql_query($strSQL);
|
ประวัติการแก้ไข 2013-11-19 22:32:45
 |
 |
 |
 |
Date :
2013-11-19 22:32:07 |
By :
ariesboy |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 04
|