It turns out that I have the following line of code that is making use of an input but it has a name that is inviting with a php variable. name='codigo_".$row['id']."'
My question is how can I make use of this name to be able to send it by post and receive it in php since I understand What is an array? Here it is complete echo "<td><input type='hidden' name='codigo_".$row['id']."' class='form-control' id='exampleInputStock' value=" . $n . ">" . $n . "</td>";
. When receiving it with post in php, would it be something like this?
$id = $_POST[codigo_$row['id']];
yes that is the question how to use this name in php?
Let's say you have an array from the database:
And for some reason you must be able to edit the value of the name or something like that and you decide that you will create one
<input type="text"/>
for each of the records and so that it is unique in it,DOM
you decide to put a generic name + the id, that is:You had a list of
<input>
with the name"persona1 , persona2, persona3 , personaN
"Important all these inputs must be inside a label
<from method="POST">
and you must also have a<input type="submit" name="Miboton">
So to get the input values you must:
When receiving it in $_POST it would be:
query, can you help me do this but with ajax? In other words, when I press submit, I go to a javascript function where I use the POST method and form.serialize() and calls the php that is going to save this data in the table. The issue is that this php, the one that receives the serialized input data, does not take the array or the input with a variable name, how do I go through and take the values of the variable input that I create in the other form (person1, person2 , person3, etc..)? Thank you very much if you can help me!!!