I connect require("objects.php"); - in in this PHP-ke I receive data from MYSQL. Data is displayed correctly in select only outside the body Inside the body tag is not displayed.
How to display a list of data in a select form ( name="object" )?

 <? require("objects.php"); ?> <head> <link href="css/style.css" rel="stylesheet"> <link rel="stylesheet" href="css/bootstrap.min.css"> <script src="js/jquery-3.2.1.min.js"></script> <title> Tex. поддержка </title> </head> <body> <div class="mainForm"> <div class="mainContent"> <form action="send.php" method="POST" class="actionForm" id="actionForm"> <br> <p class="text text-success">Заголовок обращения:</p> <input type="text" class="caption form-control" name="caption" placeholder="Заголовок обращения" required> <br> <p class="text text-success">Телефон в формате +775291231233</p> <input type="phone" class="phone form-control" name="phone" placeholder="Номер телефона(375291234567)" pattern="[^0-9]{1}[0-9]{11,12}" required> <br> <p class="text text-success"> Тип оборудования</p> <select name="" id="" class="form-control"> <option value="" selected></option> <option value="">Кассовое оборудование</option> <option value="">Весовое оборудование</option> </select> <br> <? echo '<select name="object" id="" class="form-control">'; while (($row=$result->fetch_assoc())!= false) { echo '<option value="">'.$row['format'].'</option>'; } echo "</select>"; ?> <p class="text text-success">Торговый объект</p> <input type="text" class="obj form-control" name="obj" placeholder="Номер торгового объекта" required> <br> <p class="text text-success">Описание проблемы:</p> <textarea name="text" id="" class="text form-control" cols="30" rows="5" placeholder="Опишите проблему" required></textarea> <br /> <button class="btn btn-success"> Отправить</button> <label id="result"></label> </form> </div> </div> </body> 
  • Does not bother you that you have a select in a code? - teran 4:02 pm
  • Wrong, corrected! - ZIBER MINSK
  • Usually you need to do all the processing before the output and in html send the ready data to output. - And
  • if I correctly understood "outside the body" , then what is objects.php conclusion in objects.php ? - teran
  • That's right! Only outside the body tag, output the information as it should be. As at the beginning of the page and at the end. But inside - no. Most likely the condition itself does not work. Ie is called. - ZIBER MINSK

1 answer 1

The problem was in the cache (op cache). Data gets on the form as it should. There is a problem with CSS, but that is another question. Thanks to all!