Send dynamic ids in POST to another php file

0

Hello, I am creating some dynamic inputs in the following way:

$(".reporteBody").append('<input type="text" name="titulo' + y + '" id="tiulo' + y + '" value="Caja # ' + y + '">');

Let's say that 3 inputs are created, and since they are inside a form, by means of a button I am passing them to another php file by POST and I receive it like this:

for($i=0;$i<3;$i++){
    $titulo.$i.=$_POST['titulo'.$i];
}

But I get an error when I visualize the file not in the editor, what is the correct way to pass these dynamic values (regardless of the number) and display them correctly?

Thank you.

    
asked by Baker1562 25.02.2018 в 17:56
source

1 answer

1

The problem is in:

$titulo.$i.=$_POST['titulo'.$i];

There I do not know exactly what you want to write. If it were an array it would be:

$titulo[$i] = $_POST['titulo'.$i];

That would be the most advisable.

Among other things, sending the information from the form as an arrangement is even much more stable and controllable. I recommend it.

    
answered by 25.02.2018 / 18:02
source