![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
16/06/2011, 10:26
|
| | Fecha de Ingreso: junio-2011
Mensajes: 36
Antigüedad: 13 años, 8 meses Puntos: 0 | |
Respuesta: duda php Este es el formulacio de donde hare la seleccion
<form id="envia" name="form2" method="post" action="lista.php">
<p> </p>
<table width="382" border="1">
<tr>
<td width="46"></td>
<td width="125">nombre</td>
<td width="189">precio_venta</td>
</tr>
<?php do { ?>
<tr>
<td><input name="cotizar[]" type="checkbox" id="cotizar" value="<?php echo $row_cotizacion['nombre']?>" />
<input type="hidden" name="valores[]" id="valores" value="<?php echo $row_cotizacion['precio_venta']?>"/>
<label for="cotizar"></label></td>
<td><?php echo $row_cotizacion['nombre']; ?></td>
<td><?php echo $row_cotizacion['precio_venta']; ?></td>
</tr>
<?php } while ($row_cotizacion = mysql_fetch_assoc($cotizacion)); ?>
</table>
</p>
<input type="submit" name="envia" id="envia" value="Enviar" />
</form>
Esto es laparte que va en la pagina lista.php..agregando el codigo que me sugeriste
<?php
$producto=$_POST['cotizar'];
$valores=$_POST['valores'];
//$suma=$_POST['suma'];
$cont=count($_POST['cotizar']);
$i=0;
$suma=0;
?>
<?php
while($i<$cont)
{
?>
<?php echo $producto[$i]?>
<?php echo $valores[$i]?>
<?php
$i++;
}
?>
<?php for($i=0;$i<count($_POST['cotizar']);$i++)
{
if(isset($_POST[$i]['cotizar'])!=''){
$suma = $suma + $_POST[$i]['cotizar'];
}
}
echo $suma; ?> |