Question:
I have a form with several fields containing currency values how can I add all these values in the post output
Example form
<form id="form2" name="form2" action="includes/acao.php?form=faturamento"
method="post" >
<input type='hidden' name='valor[{$id_finan}]' value='{960.00}' />
<input type='hidden' name='valor[{$id_finan}]' value='{960.00}' />
<input type='hidden' name='valor[{$id_finan}]' value='{960.00}' />
</form
action.php
foreach($_POST["checkbox"] as $key=>$value){
echo $valor = mysql_real_escape_string($_POST['valor'][$key]);
// Retorno 960.00960.00960.00
}
How to bring this added return
Answer:
# SIMULACAO
$post = array(
'valor' => array(
0 => 10,
1 => 10,
3 => 10,
4 => 10,
5 => 10,
6 => 10,
7 => 10,
)
);
# RESOLUCAO
echo array_sum($post['valor']); // 70