E
E
Erl2018-01-31 18:24:17
PHP
Erl, 2018-01-31 18:24:17

How to do an INSERT on a button?

There is a database, it has 2 tables: users and new-user (for example)
in a separate page, I display all users by their login (the login field from the users table)

<tr>
  <td>$myrow[login]</td>
<td>ещё что нибудь</td>
<td>кнопка insert (при нажатии вставляет поле login и "ещё что нибудь" в таблицу new-user)</td>
</tr>

I tried to do all this through the form, but the entry goes only to the 1st line, and let's say 100 users.
Actually, the question is how to make a button or a checkbox so that all this is entered into a table, or somehow mark all in the checkboxes first, and then write everything down with the button at once

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
ThunderCat, 2018-02-01
@ThunderCat

a couple of little code, well, yes, the meaning is approximately clear ...
Hint: input of the form

<input type='text' name='username[]' value='somename'>
inserted multiple times, will be interpreted on the server side as an array, which can be iterated over and get the entire list of your 100 rows. If the form is using the post method, then the server will have$_POST['username'][0] = 'somename';

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question