I have a table in which I bring the data from the database, but when I brought it out, I looked through the source code through Mozilla FireFox, and found an error, please tell me how to fix it?

Screenshot

Mozilla writes the following error when you move the cursor to red:

In the "table" found the initial tag "form"

I checked all the code, nowhere else are there any form tags. How to fix this error?

  • And how do you output data from the database? - alexlz
  • $ sql = mysql_query ("SELECT * FROM tb_company WHERE active = '1'"); if (mysql_num_rows ($ sql)> 0) {while ($ res = mysql_fetch_assoc ($ sql)) {$ id = $ res ["id"]; echo "<tr style = \" text-align: center; border-bottom: 2px solid black; \ "class = \" td_link \ "> <form action = \" buy.php \ "method = \" post \ "name = \" buy_form \ "> <input type = \" hidden \ "name = \" id \ "value = \" $ id \ "> <td>". $ res ["name"]. "</ td> <td>". $ res ["price"]. "</ td> <td>". $ res ["percent"]. "</ td> <td>". $ res ["summ"]. "</ td> </ form> </ tr>" ; }} - Csharp
  • @Csharp, Put the whole form in one <td> and validate - Deonis

1 answer 1

But did not try to wrap the table in FORM?

Those.

<form> <table> <tr><td><input></input></td></tr> .... </table> </form> 

This is the first

and secondly - you have <tr><form><td> , maybe it is worth trying <tr><td><form> ?

  • For the vehicle to wrap the entire table in the form will not go, because with such a structure, it needs to send only two values: id and count , so place the forms in one <td> - the solution is correct. - Deonis
  • Well, it depends on the goals, if you edit only one entry at a time - then there is no point in wrapping everything in a form, but if you need to edit several entries, then it will. And change a little for this - instead of name = "id" write name = "id[]" , etc. And "oh" ... It seemed to me that this is a form for editing records, and it is for purchase. Then - yes, in one form is not worth it. - BOPOH
  • But why not? Instead of buttons, you can make a checkbox in front of each product. It will be possible to buy not one by one, but immediately packs. Much more convenient. Although again - and if there is no such goal? .. Maybe then set it (goal)?)) - BOPOH