列表框填充但不工作php [英] list box populating but not working php

查看:119
本文介绍了列表框填充但不工作php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用网站中提供的代码来填充引导组合框。我在一个php文件中适当地添加和更改了代码,并尝试在表单之前包含该文件。但整个形式消失了。当我删除include php语句,它再次出现。
为什么和做什么,这样的代码插入这里和填充列表框,类似地,表由两个字段pincode和地方组成。当pincode填充在组合上时,用户选择pincode,那么表中的适当位置应该列在下一个文本框中。感谢您的帮助

I tried using a code given in a site to populate a bootstrap combo box. I added and changed the code appropriately in a php file and tried to include the file before the form. But the entire form got disappered. When I removed the include php statement it again appears. Why and what to do such that the code inserts here and populate the list box and similarly the table consists of two field pincode and place. When pincode populates on the combo the user selects a pincode then the appropriate place in the table should be listed in the next textbox. Thanks for help

<?php include 'pincode.php';?>
               <!-- middle column-->
            <div class="col-md-8">
                <div class="panel panel-default">
                <div class="panel-heading">
                    <h5 class="">Enter details of your school</h5>
                </div>
                <div class="panel-body">
                   <form data-toggle="validator" role="form">
  <div class="form-group textareawidth has-feedback">
    <label for="address">Enter school address</label>
    <textarea class="form-control" pattern = "^[_A-z0-9]{1,}$" maxlength="150" rows ="3" name = "saddress" id="address" placeholder="Enter address with out pincode" required></textarea>
    <span class="glyphicon form-control-feedback" aria-hidden="true"></span>
    <span class="help-block with-errors"></span>
  </div>
  <div class="form-group textareawidth">
  <label for="pin">Select list:</label>
  <select class="form-control" id="pin" name ="pin_code">
    <option>1</option>
    <option>2</option>
    <option>3</option>
    <option>4</option>
   </select>
</div>
<div class="form-group textareawidth">
    <label for="place">Place</label>
    <input type ="text" class="form-control" name = "splace" id="place" required>
    <span class="glyphicon form-control-feedback" aria-hidden="true"></span>
    <span class="help-block with-errors"></span>
</div>

我在这里包含了表单的一部分。
php文件由代码

I have included the part of the form here. The php file consists of code

<?php
$dbcon1=mysqli_connect( "localhost", "root","","simple_login") or die(mysql_error());
mysqli_select_db( $dbcon1,"" ) or die(mysql_error());

$check_place = "SELECT * country FROM pincode";
$run=mysqli_query($dbcon1,$check_place);

while($check_place = mysqli_fetch_array( $run ))
{

    $pin_code = $pincode['pin'];
    $pin_place = $country['place'];

    $pin_block .= '<OPTION value="'.$pim_code.'">'.'</OPTION>';
}
?>


推荐答案

$ check_place =SELECT * country FROM pincode

$check_place = "SELECT * country FROM pincode";

在mysql语句中有错误。

there is error in the mysql statement.

更改为

$ check_place =SELECT * FROM pincode;

$check_place = "SELECT * FROM pincode";

这将从表中获取所有行

这篇关于列表框填充但不工作php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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