How to create a text block with a submit form so that the response from the form is checked against the database cell and ...

  • 0
    Guys, please help me, I'm at a dead end ... Thank you very much in advance for your advice and help!
    The essence of the question is:
    There is a database with such fields, for example:
    I want to implement the following thing:
    When you enter a response in the input text field and click on the submit button, a request is made to compare the data of our input and the otvet database cell. If the value is input = otvet, then we output the corresponding value from the text column via php
    into our blank. Everything seems simple. But is it possible to make sure that without reloading the page, the same template is automatically created with the correct answer (input = otvet) below and the corresponding data is entered into it?
    That is, every time we enter text in input, it is checked against the database, if everything converges, then a div is automatically created with the text from the database, and a field for entering the next answer)
    include "auth.php";//Подключаем БД
    //делаем запрос
    $query = "select * from table";
    $result = mysql_query($query) or die(mysql_error());
    //если была нажата кнопка
    <meta http-equiv="Content-Type" content="text/html; Charset=UTF-8">
    <script type="text/javascript" src=""></script>
    <!--    каждый раз должен формироваться новый блок без перезагрузки-->
        <div class="middle">
        <div id="content"></div>
        <div class="pole"> 
    		<form name="perv1" class = "mid" action="index.php" method="post">
    		<input name="otvetp" type="text" placeholder="Впиши сюда ответ" >
    		<input type="submit" value="Отправить">
     <!--Конец блока>
    jQuery Anonymous, Oct 1, 2019

  • 0 Answers
Your Answer
To place the code, please use CodePen or similar tool. Thanks you!