selection onchange บันทึกลงฐานข้อมูลไม่ได้ครับ

ถาม-ตอบ แนะนำไอเดียว โค้ดตัวอย่าง แนวทาง วิธีแก้ปัญหา selection onchange บันทึกลงฐานข้อมูลไม่ได้ครับ

selection onchange บันทึกลงฐานข้อมูลไม่ได้ครับ
โค้ด module.php
<?
header("content-type: text/html; charset=utf-8");
header ("Expires: Mon, 26 Jul 2018 05:00:00 GMT");
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header ("Cache-Control: no-cache, must-revalidate");
header ("Pragma: no-cache");

include "dbconfig.php";
conndb();
          
$data = $_GET['data'];
$val = $_GET['val'];


     if ($data=='module') {
          echo "<select name='other_p' id='other_p' onChange="dochange('sub_module', this.value)"> ";
          echo "<option value='0'>กรุณาเลือก HW/SW</option> ";
          $result=mysql_db_query($dbname,"select * from module order by ID_module");
          while($row = mysql_fetch_array($result)){
               echo "<option value="$row[ID_module]" >$row[module]</option> " ;
          }
     }else if ($data=='sub_module') {
          echo "<select select name='type_p' id='type_p' onChange="dochange('sub_submodule', this.value)"> ";
          echo "<option value='0'>ประเภทของปัญหา</option> ";                             
          $result=mysql_db_query($dbname,"SELECT * FROM sub_module WHERE ID_module= '$val' ORDER BY id_sub");
          while($row = mysql_fetch_array($result)){
               echo "<option value="$row[id_sub]" >$row[submodule]</option> " ;
          }
     }
     echo "</select> ";
echo mysql_error();
closedb();

?>


โค้ด index.php
<?php require_once('Connections/helpdesk.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
mysql_select_db($database_helpdesk, $helpdesk);
$query_module = "SELECT * FROM module";
$module = mysql_query($query_module, $helpdesk) or die(mysql_error());
$row_module = mysql_fetch_assoc($module);
$totalRows_module = mysql_num_rows($module);

mysql_select_db($database_helpdesk, $helpdesk);
$query_submodule = "SELECT * FROM sub_module";
$submodule = mysql_query($query_submodule, $helpdesk) or die(mysql_error());
$row_submodule = mysql_fetch_assoc($submodule);
$totalRows_submodule = mysql_num_rows($submodule);

mysql_select_db($database_helpdesk, $helpdesk);
$query_sub_submodule = "SELECT * FROM sub_submodule";
$sub_submodule = mysql_query($query_sub_submodule, $helpdesk) or die(mysql_error());
$row_sub_submodule = mysql_fetch_assoc($sub_submodule);
$totalRows_sub_submodule = mysql_num_rows($sub_submodule);
?>
<?
session_start();
$end=time();
include("start_timer.php");
include("end_timer.php");
    
if($_SESSION['id_user'] == "")
{
header('location:index.php');
exit();
}
if($_SESSION['status1']== "ADMIN")
{
echo "This page for User only!";
exit();
}
?>
<?
include('config.php');
mysql_select_db($dbname);
$strSQL = "SELECT count(*) FROM user_problem WHERE status = '4' and txtid_user='".$_SESSION['id_user']."'" ;
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
if($objResult[0]>0)
{
//echo "test";
header("location:popup.php");
}
//else
//{
//    header("location:helpdesk.php");
//}
?>
<?
include('config.php');
mysql_select_db($dbname);
$strSQL = "SELECT * FROM user_addcontact WHERE id_user = '".$_SESSION['id_user']."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
?>
<?php
//date_default_timezone_set("Asia/Bangkok");
$hour = +0;
$min = 0;
$smin = 0;
$Year = date("Y");
$thaimonth=array("01","02","03","04","05","06","07","08","09","10", "11","12");
 
$mtoday=date("d",mktime( date("H")+$hour, date("i")+$min ));
$mtime=date("H:i:s",mktime( date("H")+$hour, date("i")+$min, date("s")+$smin ));
$mdate=$mtoday."/".$thaimonth[date("m")-1]."/".$Year;
//echo "$mdate $mtime";
//ajax date and time
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ระบบแจ้งปัญหาออนไลน์ Helpdesk Online For IT</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<script src="Scripts/swfobject_modified.js" type="text/javascript"></script>
<script src="mod.js" type="text/javascript"></script>
<script type="text/javascript" src="js/cufon-yui.js"></script>
<script type="text/javascript" src="js/arial.js"></script>
<script type="text/javascript" src="js/cuf_run.js"></script>
<script type='text/javascript' src='function.js'></script>
<!--               scrip เช็คค่าว่าง ------------>
<script language="javascript">
function fncSubmit()
{
if(document.form1.txtid_user.value == "")
{
alert('กรุณาใส่รหัสพนักงาน');
document.form1.txtid_user.focus();
return false;
}    
if(document.form1.txtuserName.value == "")
{
alert('กรุณาใส่ชื่อพนักงาน');
document.form1.txtuserName.focus();         
return false;
}
if(document.form1.txtuserDepart.value == "")
{
alert('กรุณากรอกแผนอก');
document.form1.txtuserDepart.focus();         
return false;
}    if(document.form1.Floor.value == "")
{
alert('กรุณาระบุชั้น');
document.form1.Floor.focus();         
return false;
}    if(document.form1.txtuserTel.value == "")
{
alert('กรุณาระบุเบอร์โทร');
document.form1.txtuserTel.focus();         
return false;
}    if(document.form1.txtuserMail.value == "")
{
alert('กรุณาระบุอีเมล์');
document.form1.txtuserMail.focus();         
return false;
}    if(document.form1.des.value == "")
{
alert('กรุณากรอกรายละเอียดของปัญหา');
document.form1.des.focus();         
return false;
}    
document.form1.submit();
}
</script>
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<center>
  <table width="990" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td><table width="100%" border="0" cellpadding="0" cellspacing="0">
       <tr>
          <td><img src="images/ch_autoservice-it.png" alt="" width="990" height="90" /></td>
          </tr>
          <tr align="left">
            <td><table width="100%" border="0" class="style3" bgcolor="#CC3300">
              <tr>
                <td width="48%"><b><font color="#FFFF00"><img src="images/user.png" alt="" width="16" height="16" />สวัสดีคุณ&nbsp;&nbsp;
                  <?=$objResult["userName"];?>
                  </font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                  <input name="out" type="button" id="out" value="ออกจากระบบ" onclick="location.href='logout.php'" />
                </b></td>
                <td width="1%" align="center">|</td>
                <td width="10%" align="left"><a href="profile_user.php"><font color="#FFFFFF">ข้อมูลผู้ใช้งาน</font></a></td>
                <td width="1%" align="center">|</td>
                <td width="9%" align="left"><a href="helpdesk.php"><font color="#FFFFFF">แจ้งปัญหา</font></a></td>
                <td width="1%" align="center">|</td>
                <td width="14%" align="left"><a href="tb_helpdesk.php"><font color="#FFFFFF">ปัญหาเฉพาะผู้ใช้งาน</font></a></td>
                <td width="1%" align="center">|</td>
                <td width="15%" align="left"><a href="depart_helpdesk.php"><font color="#FFFFFF">ปัญหาเฉพาะหน่วยงาน</font></a></td>
              </tr>
          </table></td></tr>
        <tr align="left">
          <td bgcolor="#FFD5FF"></td>
        </tr>
        <tr align="left">
          <td class="style4"><table width="100%" border="0" bgcolor="#FFFFFF" cellpadding="0" cellspacing="0">
            <form action="insert_user.php" method="post" enctype="multipart/form-data" name="form1" id="form1" onsubmit="JavaScript:return fncSubmit();">
              <tr align="left">
                <td colspan="4"><img src="images/git20.gif" alt="" width="52" height="48" hspace="10" align="left" />
                  <dd class="style1"><font color="#0033FF">แจ้งปัญหาการใช้งานระบบสารสนเทศภายในบริษัทยิบอินซอย</font></dd>
                  <dd class="text"> <span class="style3">ขอให้เจ้าหน้าที่ทุกท่านกรอกข้อมูลรายละเอียดของปัญหาอย่างละเอียด</span></dd></td>
              </tr>
              <tr align="left">
                <td colspan="4"><table width="100%" border="0" bordercolor="#FF99FF" cellpadding="0" cellspacing="0">
                  <tr bgcolor="#FFD7FF">
                    <td colspan="2" bgcolor="#FFD7FF" class="style2"><b>ข้อมูลผู้แจ้งปัญหา</b></td>
                    <td width="20%" class="style2">&nbsp;</td>
                    <td width="30%" class="style2">&nbsp;</td>
                  </tr>
                  <tr bgcolor="#FFCCFF">
                    <td width="20%" bgcolor="#FFECFF" class="style2">รหัสพนักงาน : </td>
                    <td width="30%" bgcolor="#FFECFF" class="style3"><input name="txtid_user" type="text" class="style3" id="txtuserName2" size="15" maxlength="6" readonly="readonly" value="<?=$objResult["id_user"];?>" style="background-color:#DFDFDF" />
                      <!--<input name="txtid_user" type="text" class="style3" id="txtid_user" onChange="JavaScript:doCallAjax('txtid_user','txtuserName','txtuserDepart','Floor','txtuserTel','txtuserMail');" /> --></td>
                    <td bgcolor="#FFECFF" class="style2">ชื่อผู้แจ้งปัญหา :</td>
                    <td bgcolor="#FFECFF" class="style3"><input name="txtuserName" type="text" class="style3" id="txtuserName" style="background-color:#DFDFDF" value="<?=$objResult["userName"];?>" size="30" readonly="readonly" /></td>
                  </tr>
                  <tr bgcolor="#FFCCFF">
                    <td bgcolor="#FFECFF" class="style2">ชื่อเล่น :</td>
                    <td bgcolor="#FFECFF" class="style3"><input name="NikName" type="text" class="style3" id="NikName" value="<?=$objResult["NikName"];?>" style="background-color:#DFDFDF" readonly="readonly" /></td>
                    <td bgcolor="#FFECFF" class="style2">หน่วยงาน / แผนก :</td>
                    <td bgcolor="#FFECFF" class="style3"><input name="txtuserDepart" type="text" class="style3" id="txtuserDepart" size="30" maxlength="6" readonly="readonly" value="<?=$objResult["userDepart"];?>" style="background-color:#DFDFDF" /></td>
                  </tr>
                  <tr bgcolor="#FFCCFF">
                    <td bgcolor="#FFECFF" class="style2">ชั้น :</td>
                    <td bgcolor="#FFECFF" class="style3"><input name="Floor" type="text" class="style3" id="Floor" readonly="readonly" value="<?=$objResult["Floor"];?>" style="background-color:#DFDFDF" /></td>
                    <td bgcolor="#FFECFF" class="style2">เบอร์โทร :</td>
                    <td bgcolor="#FFECFF" class="style3" ><input name="txtuserTel" type="text" class="style3" id="txtuserTel" value="<?=$objResult["userTel"];?>" size="30"/></td>
                  </tr>
                  <tr bgcolor="#FFCCFF">
                    <td bgcolor="#FFECFF" class="style2">เบอร์แฟกซ์ :</td>
                    <td bgcolor="#FFECFF" class="style3"><input name="Fax" type="text" class="style3" id="Fax" value="<?=$objResult["Fax"];?>" readonly="readonly" style="background-color:#DFDFDF"/></td>
                    <td bgcolor="#FFECFF" class="style2">เบอร์มือถือ :</td>
                    <td bgcolor="#FFECFF" class="style3"><input name="Mobile" type="text" class="style3" id="Mobile" value="<?=$objResult["Mobile"];?>" size="30"/></td>
                  </tr>
                  <tr bgcolor="#FFCCFF">
                    <td bgcolor="#FFECFF" class="style2">อีเมล์ yit :</td>
                    <td bgcolor="#FFECFF" class="style3" ><input name="txtuserMail" type="text" class="style3" id="txtuserMail" readonly="readonly" value="<?=$objResult["userMail"];?>" style="background-color:#DFDFDF" /></td>
                    <td bgcolor="#FFECFF" class="style2">อีเมล์ other :</td>
                    <td bgcolor="#FFECFF" class="style3"><input name="Email_Ext" type="text" class="style3" id="Email_Ext" style="background-color:#DFDFDF" value="<?=$objResult["Email_Ext"];?>" size="30" readonly="readonly" /></td>
                  </tr>
                  <tr bgcolor="#FF66FF">
                    <td height="23" colspan="4" align="left" bgcolor="#FFD7FF" class="style2"><b>รายละเอียดปัญหา&nbsp;&nbsp;&nbsp;<font color="red">กรุณากรอกข้อมูลให้ละเอียดและครบถ้วน </font></b></td>
                  </tr>
                  <tr class="style11" align="left" bgcolor="#FFCCFF" valign="top">
                    <td bgcolor="#FFECFF" class="style2">ประเภทของปัญหา</td>
                    <td colspan="3" bgcolor="#FFECFF" class="style3"><font id="module">
                      <select name="other_p" id="other_p">
                        <option value="">กรุณาเลือก HW/SW</option>
                      </select>
                    </font></font> &nbsp;&nbsp;<font id="sub_module">
                    <select name="type_p" id="type_p">
                      <option value="">ประเภทของปัญหา</option>
                    </select>
                    </font> &nbsp;&nbsp;&nbsp;<font color="#FF0000">** กรณีเลือกประเภทไม่ได้กด F5</font></td>
                  </tr>
                  <tr class="style11" align="left" bgcolor="#FFCCFF" valign="top">
                    <td bgcolor="#FFECFF" class="style2">รายละเอียดของปัญหา :</td>
                    <td colspan="3" bgcolor="#FFECFF" class="style3"><textarea name="des" id="des" cols="90" rows="5" class="style3"></textarea></td>
                  </tr>
                  <tr align="left" bgcolor="#FFCCFF">
                    <td valign="top" bgcolor="#FFECFF" class="style2">สถานะปัญหา :</td>
                    <td colspan="3" bgcolor="#FFECFF" class="style2"><select name="status" id="status">
                      <option value="1">New (แจ้งใหม่)</option>
                      </select></td>
                  </tr>
                  <tr>
                    <td colspan="4" bgcolor="#FFECFF">&nbsp;</td>
                  </tr>
                  <tr bgcolor="#FF66FF">
                    <td colspan="4" align="center" bgcolor="#FFD7FF"><input type="submit" name="submit" id="submit" value="ส่งข้อมูล" class="style21" />
                      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                      <input name="cancel" type="reset" value="ยกเลิก" class="style21" /></td>
                  </tr>
                </table></td>
              </tr>
              <tr>
                <td colspan="4"></td>
              </tr>
            </form>
          </table></td>
        </tr>
        <tr align="center" bgcolor="#F0F0F0">
          <td class="style4"> &copy; <strong>: : Yip In Tsoi helpdesk :   :</strong><br />
เว็บอินทราเน็ต : <a href="http://intranet.yipintsoi.com" target="_blank">บริษัทยิบอินซอย</a>   Email : <a href="mailto:support@yipintsoi.com">support@yipintsoi.com</a></td>
          </tr>
      </table></td>
</tr>
  </table>

</center>
</body>
</html>

สามารถทำงานได้ปกติทุกอย่างแต่บันทึกลงฐานข้อมูลแล้วเป็นค่าว่างครับ


Pongsatorn30 101.108.12.xxx 09-02-2016 21:14:47

คำแนะนำ และการใช้งาน

สมาชิก กรุณา ล็อกอินเข้าระบบ เพื่อตั้งคำถามใหม่ หรือ ตอบคำถาม สมาชิกใหม่ สมัครสมาชิกได้ที่ สมัครสมาชิก


  • ถาม-ตอบ กรุณา ล็อกอินเข้าระบบ
  • เปลี่ยน


    ( หรือ เข้าใช้งานผ่าน Social Login )

 ความคิดเห็นที่ 1


ninenik 180.183.51.xxx 10-02-2016






เว็บไซต์ของเราให้บริการเนื้อหาบทความสำหรับนักพัฒนา โดยพึ่งพารายได้เล็กน้อยจากการแสดงโฆษณา โปรดสนับสนุนเว็บไซต์ของเราด้วยการปิดการใช้งานตัวปิดกั้นโฆษณา (Disable Ads Blocker) ขอบคุณครับ