Hello. I have a table with the goods ( test ). And I created a second table to write there additional product parameters ( extendtovar ). Since the list is large, and I want to add everything quickly, I created a code in the administration panel that displays me a list of all products, and a field for entering the text of the additional parameter pages

  $todb = $mysqli->query('SELECT test.id AS id, test.name AS name, extendtovar.id AS id2, extendtovar.pages AS pages FROM test LEFT JOIN extendtovar ON test.id = extendtovar.id WHERE test.remainder > 0'); while ($row = $todb->fetch_array()) { echo $row[id]; echo $row[name]; echo '<input type="text" name="text" value="'.$row[pages].'"><br>'; } 

According to my logic, after entering data in all rows, you need to write them back to the table. I added a button

 <form method="post" class="update"> <input value="update" class="submit" type="submit" name="submit"><br><br><br> </form> 

And I just can not understand what the correct query to write when you click on it. Need to use update? But how to write massively this.

    1 answer 1

    First, you do not have an action attribute for the form. So no script processes it.

    Secondly, php supports arrays in POST and GET data. All you need to do is add [] in the input name. For example:

     <input name="input[0][title]" type="text"> <input name="title[0]" type="text"> 
    • So no script processes it. - not really. The request will be sent to the same URL where the form is located. - D-side