php我想使用输入字段值来查询同一表单中另一个字段的数据库查询

时间:2017-10-27 14:33:43

标签: javascript php mysql

我有数据库名称" predefine_value"并且在那个数据库中我存储了registr_no,aircraft_type和mtow,我想要的是当用户输入注册号进入输入字段以使用数据库查询中的注册号字段并从数据库中检索aircraft_type和mtow并自动填充在该数据库中的aircraft_type和mtow字段形成。 我不是javascript请帮助

Just Side note我是网络工程师的交易我把这个项目作为志愿者,因为我在大学里做了几个php项目。我不担心安全问题,因为这将在本地托管,很少有计算机可以访问这个服务器

<table>
        <form method="post" action="">
            <tr>

            <?php
                include ("connect.php");
                global $con;  
                $g = mysqli_query($con,"select max(id) from plane_info");
                while($id=mysqli_fetch_array($g))
                {
            ?>

                <th>ID:</th>
                <td><input type="text" name="txtid" value="<?php echo $id[0]+1; ?>" readonly="readonly" /></td>
            </tr>
            <?php
                }
            ?>

            <tr>
                <th>Registration No:</th>
                <td><input type="text" name="txtregistr_no" /></td>
            </tr>
            <?php

                $registr_no=txtregistr_no;
                $k = mysqli_query($con1,"select aircraft_type mtow from predefine_value where registr_no=".$registr_no);
                while($registr_no=mysqli_fetch_array($k))
                {
                }
            ?>
            <tr>
                <th>Aircraft_type:</th>
                <td><input type="text" name="aircraft_type" value="<?php echo $registr_no[1];?>"  /></td>
            </tr>
            <tr>`
                <th>MTOW:</th>
                <td><input type="text" name="mtow" value="<?php echo $registr_no[2];?>"  /></td>
            </tr>

0 个答案:

没有答案