Getting forms data in php with cycles

0

I need to use some PHP loop to get the form data on a rendering page. I thought of putting a count variable inside an input name ID box, like this:

$c=1;
while($c <= 5) {
  $tabela[$c]= $_POST['nome$c'];
}

You could print later using:

$c2= 1;
while($c2 <= 5) {
  echo $tabela[$c2];
}

The server can not identify $_POST['nome$c']; , I do not know what I'm doing

    
asked by anonymous 15.06.2017 / 03:14

1 answer

0

This occurs because of the difference in quotation marks simple and double in php , I recommend you read this to understand. In your case you have two options (you actually have other options):

Use '...'.$c :

$_POST['nome'.$c];

Use "...$c" :

$_POST["nome$c"];

Choose one of them.

    
15.06.2017 / 06:12