A petición de xempro:
Código PHP:
<?php
foreach($precio as $pre)
{
if($pre!=0)
{
$prectot=$prectot+$pre;
}
}
?>
<input name="precio" type="text" id="precio" value="<?php echo $prectot; ?>" size="10" readonly="">
</font></td>
<?php
La llave que cierra al foreach la había puesto al final de:
<input name="precio" type="text" id="precio" value="<?php echo $prectot; ?>" size="10" readonly="">
y la puse antes de:
<input name="precio" type="text" id="precio" value="<?php echo $prectot; ?>" size="10" readonly="">
y así me funcionó.