I'm trying to loop through an array of variable names to grab values from a form and assign the values to variables. It's not working--none of the form values get picked up. Here's what I've tried:
The echo statement outputs:
field1:
field2:
etc.
Okay, so what stupid mistake am I making?
Code:
$field_list = array("field1","field2",etc.)
foreach ($field_list as $value)
{
$$value = $_POST[$value];
echo "<br>".$value.": ".$$value;
}
The echo statement outputs:
field1:
field2:
etc.
Okay, so what stupid mistake am I making?