How to get id of a component(html) using php?

There is sweat this code
<input size="4" class="text" id="' . $row['id'] . ':_1" value=" . $row[" price_1'] . '><input type="submit" value="OK">

like when you click on the button('submit') get id of the component
echo "/* here id component input*/"
June 5th 19 at 21:29
2 answers
June 5th 19 at 21:31
To retrieve the value by ID and use js to send AJAX
June 5th 19 at 21:33
to write to the database the data I need id

About to write to the database, you need to understand two different situations:
a) insert record;
b) updating a record.
To insert id and pass do not need to know, the key itself must be generated by the auto-increment or the corresponding trigger on insert.
To update the record, of course, need to pass some ID or unique label to uniquely to allow update option. In the primitive case the label will be the ID. It can be passed to hidden field and it will be enough.
<form action method="POST">
<input type="hidden" name="id" value="5">
<input type="sabmit" value="Send">

On the server side, the name and value fields are also sought in the incoming arrays, like other input fields:
$id = $_POST['id']; // which method sent the form, so accepted on the server - it's simple.

Find more questions by tags HTMLPHP