If this is coming from a set of form fields, simply name them "prod_newprice[1]" instead of "prod_newprice1". Then they will be a sub-array of $POST, e.g. "$POST[prod_newprice][1]", which could then easily be incorporated into your object as:
$detail->$_POST['prod_newprice'];
If I've guessed completely incorrectly what the situation is, then we might need more info to provide an applicable solution.
PS: If you just want to stick with your original approach, it would be something like:
$detail->${'prod_newprice'.$prodnumber}.