druidfog
03-17-2010, 10:38 PM
I don't know what this is called in order to referece it. Basically I see that you can do a loop to automatically increment a variable (not the value of a variable) like this:
$var1 = "line 1<br>";
$var2 = "line 2<br>";
for ( $i = 1; $i <= 40; $i++) {
echo ${'var'.$i};
}
What I don't know if it's possible is to do that with a $_POST. For example after a person submits a form with 40 fields, it sends to $_POST['field1'] and so on to 40. Instead of echoing every $_POST or manually assigning it an intermediate variable, I'd just like to do an incremental loop with the $_POSTs for the handling.
1. What is the ${'var'.$i} concept called?
2. How would this work with $_POST?
$var1 = "line 1<br>";
$var2 = "line 2<br>";
for ( $i = 1; $i <= 40; $i++) {
echo ${'var'.$i};
}
What I don't know if it's possible is to do that with a $_POST. For example after a person submits a form with 40 fields, it sends to $_POST['field1'] and so on to 40. Instead of echoing every $_POST or manually assigning it an intermediate variable, I'd just like to do an incremental loop with the $_POSTs for the handling.
1. What is the ${'var'.$i} concept called?
2. How would this work with $_POST?