Viewing file: umQuestion.php (3.18 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<? include_once("pagebody.php"); pageHeader(); $pageTitle="ข้อมูลคำถาม"; ?> <table width=100% class="pageTitleBgColor" align="center"> <tr><td align=center><? echo $pageTitle; ?></td></tr> </table> <!--your code here--------------------------------------------------------------------------> <p><br> <? include_once "clsUmQuestion.php"; $oC = new clsConnection($GLOBALS['HOST'], $GLOBALS['DB'], $GLOBALS['USER'], $GLOBALS['PASSWORD']); $oQ = new umquestion($oC);
$oF = new clsForm(); if($method<>"") include_once("processUmQuestion.php"); echo "<form name=formdata method=post>"; echo $oF->Hidden("method") . $oF->Hidden("QsID", $QsID); $oT = new clsTable(array("รหัส","คำถาม(ท)","คำถาม(อ)","ดำเนินการ")); $oT->align="center"; $oT->headerBgColor="#EEEEEE"; $oQ->RSumquestion(); while($oQ->GetRecord()){ $oT->rowStart(); $oT->addCell($oQ->QsID,"center"); if ($method=="FormEdit" and $oQ->QsID==$QsID){ $oT->addCell($oF->Text("QsDescT", $oQ->QsDescT,30) ); $oT->addCell($oF->Text("QsDescE", $oQ->QsDescE,30) ); $oT->addCell("<a href=\"javascript:doEdit($oQ->QsID)\"><img src=\"images/new.gif\" border=0 alt=\"แก้ไขข้อมูล\"></a> <a href=\"javascript:doDelete($oQ->QsID,'$oQ->QsDescT')\"><img src=\"images/del.gif\" border=0 alt=\"ลบข้อมูล\"></a>","center"); }else{ $oT->addCell($oQ->QsDescT); $oT->addCell($oQ->QsDescE); $oT->addCell("<a href=\"javascript:doFormEdit($oQ->QsID)\"><img src=\"images/edit.gif\" border=0 alt=\"แก้ไขข้อมูล\"></a> <a href=\"javascript:doDelete($oQ->QsID,'$oQ->QsDescT')\"><img src=\"images/del.gif\" border=0 alt=\"ลบข้อมูล\"></a>","center"); } //if $oT->rowEnd(); } //while if ($method=="FormAdd"){ $oT->rowStart(0); $oT->addCell("(Auto)","","#FFFFFF", "center"); $oT->addCell($oF->Text("QsDescT", "" ,30)); $oT->addCell($oF->Text("QsDescE", "" ,30)); $oT->addCell("<input type=button name=add value=บันทึก onclick=\"doAdd()\">","center","",2); $oT->rowEnd(); }else{ $oT->rowStart("","#eeeeee"); $oT->addCell("","right","",3); //$oT->addCell("<input type=button name=add value=เพิ่ม onclick=\"doFormAdd()\">","center","",2); $oT->addCell("<a href=\"javascript:onclick=doFormAdd()\"><img src=images/new.gif border=0></a>","center","",2); $oT->rowEnd(); } echo $oT->output(); echo "</form>"; //================================== pageFooter(); ?>
<script language="javascript"> function doFormAdd(){ document.formdata.method.value="FormAdd"; document.formdata.submit(); } function doFormEdit(id){ document.formdata.method.value="FormEdit"; document.formdata.QsID.value=id; document.formdata.submit(); } function doAdd(){ if (dataAllValid(document.formdata)){ document.formdata.method.value="add"; document.formdata.submit(); } } function doEdit(id){ if (dataAllValid(document.formdata)){ document.formdata.method.value="edit"; document.formdata.QsID.value=id; document.formdata.submit(); } } function doDelete(id,name){ if (confirm('ต้องการลบ' + name + ' ใช่หรือไม่') ){ document.formdata.method.value="delete"; document.formdata.QsID.value=id; document.formdata.submit(); } } function dataAllValid(f){ if (IsEmpty(f.QsDescT, "กรุณาป้อนรายการรายรับ")) return false; if (IsEmpty(f.QsDescE, "กรุณาป้อนรายการรายรับ")) return false; return true; } </script>
|