从dropdownlist ini php的数据库onchange事件中恢复数据 [英] Retrive data from data base onchange event of dropdownlist ini php

查看:64
本文介绍了从dropdownlist ini php的数据库onchange事件中恢复数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 <  表格   名称  =  form1   方法  =  post    onsubmit   = <跨度类= 代码关键字> xmlhttpPost( '为registration.php', 'form1中', 'colam', '请稍候');返回false; < span class =code-keyword>>  
< table width = 600 align < span class =code-keyword> = center class = cellpadding = 1 cellspacing = 1 >

< tr >
< td align = right > N ame:< / td > < td align = left > < 输入 类型 = text 名称 = txt_name value = > < / td > < / tr >
< tr > < td align = right > 地址:< / td > < td 对齐 = left > < 输入 type = text name = txt_addrs value = > < / td > < / tr >
< tr > < td align = right > 电子邮件ID:< / td > < td > < 输入 type = text < span class =code-attribute> name = txt_email value = > < / td > < / tr >
< tr > < td align = right > 联系号:< / td > < td > < <跨度 class =code-leadattribute> input type = text name = txt_cnumber < span class =code-attribute> value = > < / td > < / tr >
< tr > < td align = > 选择食物类型:< / td > < td > < select name = selectfood id = selectfood onchange = ajaxpage('choice.php?ID ='+ this.value,'choicefood') >
< span class =code-summarycomment><? php
< span class =code-summarycomment>
< span class =code-summarycomment> $ result = mysqli_query($ con, SELECT distinct item_type FROM < span class =code-summarycomment> tbl_master);

< span class =code-summarycomment> while($ row = mysqli_fetch_array($ result))

< span class =code-summarycomment> {? > ;

< 选项 value = <?php echo $ row ['item_type']; {echo 已选择;}? > > <? php echo ($ row ['item_type']);? > < / option >

<? php < span class =code-summarycomment>

< span class =code-summarycomment> < span class =code-summarycomment> }

>
< / select >
< / td > < / tr >

< td colspan = 2 align = center >
< input type = submit name = 提交 value = 提交 > &安培; NBSP;&安培; NBSP;&安培; NBSP;&安培; NBSP;&安培; NBSP;
< 输入 < span class =code-attribute> type
= hidden 名称 = 行动 value = ADD id = 行动 标题 = 提交 / >
< input 类型 = 重置 名称 = 重置 value = 重置 > < / td > < tr >





< / tr >

< / table >
< / form >

解决方案

结果 = mysqli_query(


con, SELECT distinct item_type FROM tbl_master);

< span class =code-summarycomment> while(


row = mysqli_fetch_array(

<form name="form1" method="post" onsubmit="xmlhttpPost('registration.php','form1','colam','please wait  '); return false;">
    <table width="600" align="center" class="" cellpadding="1" cellspacing="1">

        <tr>
        <td align="right">Name :</td><td align="left"><input type="text" name="txt_name" value=""></td></tr>
        <tr><td align="right">Address :</td><td align="left"><input type="text" name="txt_addrs" value=""></td></tr>
        <tr><td align="right">E- Mail ID :</td><td><input type="text" name="txt_email" value=""></td></tr>
         <tr><td align="right">Contact No. :</td><td><input type="text" name="txt_cnumber" value=""></td></tr>
        <tr><td align="right">Select Food Type :</td><td><select  name="selectfood" id="selectfood" onchange="ajaxpage('choice.php?ID='+this.value,'choicefood')">
                    <?php

                     $result = mysqli_query($con,"SELECT distinct item_type FROM tbl_master");

                    while($row = mysqli_fetch_array($result))

                    {?>

                     <option value="<?php echo $row['item_type']; {echo "Selected";}?>"><?php echo ($row['item_type']);?></option>

                    <?php

                    }

                    ?>
                    </select>
        </td></tr>

        <td colspan="2" align="center">
        <input type="submit" name="submit" value="Submit">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="hidden" name="ACTION" value="ADD" id="ACTION" title="submit" />
        <input type="reset" name="reset" value="Reset"></td><tr>





  </tr>

    </table>
            </form>

解决方案

result = mysqli_query(


con,"SELECT distinct item_type FROM tbl_master"); while(


row = mysqli_fetch_array(


这篇关于从dropdownlist ini php的数据库onchange事件中恢复数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆