Ok so, I am building something for my employer for them to input products, they have very specific requirements. I have a form with dynamically generated fields like so... (obvi
inputted value = height
inputted value = width
foreach ($_POST['attribute'] as $attributes){
echo key($attributes).' '.$attributes.'
';
}
Note here that you are looping over the attribute array in post. $attributes is the value for each field (and is therefore not an array.
Instead of using key()
try:
foreach ($_POST['attribute'] as $attributeKey => $attributes){
echo $attributeKey.' '.$attributes.'
';
}