I have a form, here it is:

<input type="text" name="phone" method="post" action="upd.php" class="form-control" placeholder="Номер телефона"> <input type="text" name="comment" method="post" action="upd.php" class="form-control" placeholder="Что изменить"> <button type="submit" name="btn-send" formmethod="post" formaction="upd.php" class="btn btn-rounded btn-success mb-3">Отправить</button> 

How do I make this form work?

  • Divide this question by two. To begin, learn to send the form. And then, without any connection with the forms, we will learn to fulfill queries to the database - Ipatiev
  • one
    you have no form - Vitaliy Shebanits
  • @ Ipatiev yes, thank you, the form went, the request to the database was correct - web2k17
  • query the database to correct as from here to Jupiter. What unpleasantly you still have to make sure - Ipatyev

2 answers 2

Wrap all this in a <form> tag indicating the type of POST request of course

 <form type="post" action="upd.php"> <input ...> <input ...> <button ...>Кнопка</button> </form> 

In the inputs themselves, the method and action attributes are not processed by the browser.

  • It worked, thanks! - web2k17

You stuck a bunch of unnecessary attributes to the tags (they do not even exist for them).

 <form action="site.php" method="POST"> <div class="form-group"> <label for="inputText">Text</label> <input type="text" class="form-control" name="inputText" id="inputText" aria-describedby="helpId" placeholder="text"> <small id="helpId">Help text</small> </div> <button type="submit">Submit</button> </form>