$_post $var - how to post as a variable

$_post $var - how to post as a variable

$_post $var - how to post as a variable

how to post $_POST[$var.$id], I wanted to create a variable that looped through a counter based on the number of fields on the form and input them into a database. I didn't always know how many fields were on the form so i created this mini script to loop through;

$nofields =$_POST['nofields']; //no of fields submitted $a=1; //counter start

while ($a<=$nofields) {
$fn="varname".$a;
$fieldname=$_POST[$fn];
echo "$fieldname";
$a=$a+1;
}
}
}

 


SELL SELL SELL