首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >JQWidgets组合框类型的值未回显或未提交到数据库

JQWidgets组合框类型的值未回显或未提交到数据库
EN

Stack Overflow用户
提问于 2016-07-11 20:40:38
回答 0查看 93关注 0票数 0

下面是我正在使用的代码,当我从数据库中选择值时,它们被提交到数据库,但是如果我输入了数据库中没有的东西,我想提交它,它不会被PHP提交或回显。谁来帮帮我。

谢谢。

代码语言:javascript
复制
 <?php
//Jason File
      #Include the connect.php file
      include('db_connect2.php');
     //get county of selected district
     $query = "SELECT * FROM primary_schools ";

      $result = mysql_query($query) or die("SQL Error 1: " . mysql_error());
      while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
          $customers[] = array(
              'Emis_No' => $row['Emis_No'],
              'District' => $row['District'],
              'County' => $row['County'],
              'Subcounty' => $row['Subcounty'],
              'Parish' => $row['Parish'],
              'School' => $row['School']
               );
      }

      echo json_encode($customers);
    ?>

//Script
<script type=”text/javascript”>
$(document).ready(function () {
        //start EMIS code
            var customersSourcel =
        {
            datatype: "json",
            datafields: [
                { name: 'Emis_No'},
                { name: 'District'},
                { name: 'County'},
                { name: 'Subcounty'},
                { name: 'Parish'},
                { name: 'School'}
            ],
            url: 'includes/emis.php',
            cache: false,
            async: false
        };

        var customersAdapterl = new $.jqx.dataAdapter(customersSourcel);

        $("#emis_no").jqxComboBox(
        {
            source: customersAdapterl,

            width: 200,
            height: 25,
            promptText: "emis",
            displayMember: 'Emis_No',
            valueMember: 'Emis_No'
        });

        $("#emis_no").bind('select', function(event) 
        {
            if (event.args)
            {
                var index = $("#emis_no").jqxComboBox('selectedIndex');     
                if (index != -1)
                {
                    var record = customersAdapterl.records[index];
                    document.form1.district.value = record.District;
                    $("#county").jqxComboBox({ disabled: false});
                    document.form1.county.value = record.County;
                    $("#sub_county").jqxComboBox({ disabled: false});
                    document.form1.sub_county.value = record.Subcounty;
                    $("#parish").jqxComboBox({ disabled: false});
                    document.form1.parish.value = record.Parish;
                    $("#school").jqxComboBox({ disabled: false});
                    document.form1.school.value = record.School;
                }
            }
        });  
EN

回答

页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38307199

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档