简体   繁体   中英

After submitting form a part of the form is not loading php,html

I have a form with some datalist tag for which the values are loaded from database. when the page is opened everything works fine but after submitting the form the code after the datalist is not working.

提交前

After Submission

提交后

My Code

<label> Place</label>
 <input list="places" name="place" value="<?php echo $place;?>"><br/>
 <datalist id="places">
    <?php
        $result=$conn->query("SELECT vchr_place FROM tbl_academy_admission");
        $opt_places="";
        while($row=$result->fetch_assoc())
        {
            $opt_places.="<option value='".$row['vchr_place']."'>";
        }
        echo $opt_places;
    ?>
</datalist>

No options to the datalist tag will result in datalist not displayed.

Are you sure the query is returning records? try adding <option value="Test"> before your php tag. If the options is displayed then that's the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM