confirmacion.php:
Código PHP:
<?php
session_start();
//Iniciamos o retomamos la sesión
$carro=$_SESSION['carro'];
//La asignamos a la variable $carro
?>
<?php
if($carro){
//si el carro no está vacío, mostramos los productos
?>
<table width="800" border="0" bgcolor="#FFFFFF" cellspacing="1" align="center">
<td height="12" colspan="5" valign="top"><div align="left" class="h1 Estilo6 Estilo9">Detalles de su Pedido: </div></td>
</tr>
<tr>
<tr bgcolor="#000066" class="tit">
<td width="2" align="center">Cantidades</td>
<td width="2" align="center">Artista</td>
<td width="2" align="center">Titulo</td>
<td width="2" align="center">Precio</td>
</tr>
<?php
$color=array("#FFFFFF","#F0F0F0");
$contador=0;
//las 2 líneas anteriores sirven para hacer una tabla con colores alternos
$suma=0;
//antes de recorrer todos los valores de la matriz carro, ponemos a cero la variable $suma,
//en la que iremos sumando los subtotales del costo de cada item por la cantidad de unidades que se especifiquen
foreach($carro as $k => $v){
//recorremos la matriz que tiene todos los valores del carro, calculamos el subtotal y el total
$total=$v['cantidad']*$v['Precio'];
$suma=$suma+$total;
$grantotal=$suma+7500;
$contador++;//este es el contador que usamos para los colores alternos
?>
<tr bgcolor="<?php echo $color[$contador%2]; ?>" class='prod'>
<td><?php echo $v['cantidad'] ?></td>
<td><?php echo $v['Artista'] ?></td>
<td><?php echo $v['Titulo'] ?></td>
<td><?php echo $v['Precio'] ?></td>
</td>
</tr></form>
<?php
//por cada item creamos un formulario que submite a agregar producto y un link que permite eliminarlos
}?>
</table>
<table align="center" width="800" border="0" bgcolor="#FFFFFF">
<!--DWLayoutTable-->
<tr bgcolor="#FFFFFF"><hr />
<td width="577" height="21"></td>
<td colspan="2" valign="top"><div align="right"><span class="Estilo2 Estilo6 Estilo11">SubTotal (IVA inc.):</span></div></td>
<td width="73" valign="top"><?php echo number_format($suma,2);?></td>
<tr bgcolor="#FFFFFF">
<td height="21"></td>
<td width="55"> </td>
<td width="77" valign="top"><div align="right"><span class="Estilo12">Envio:</span></div></td>
<td valign="top"><span class="Estilo12"> </span>7,500.00</td>
<tr bgcolor="#FFFFFF">
<td height="21"></td>
<td></td>
<td valign="top"><div align="right"><span class="Estilo12">Total: </span></div></td>
<td valign="top"><?php echo number_format($grantotal,2); ?></td>
</table>
<table width="800" border="0" bgcolor="#FFFFFF" align="center">
<td height="12" colspan="5" valign="top"><div align="left" class="h1 Estilo6 Estilo9">Por favor complete la siguiente información para poder procesar su pedido:</div></td>
<tr bgcolor="#000066" class="tit">
<td colspan="10">Detalles de Cobro y Envio:</td></tr>
</table>
<table width="800" height="300" border="0" bgcolor="#FFFFFF" align="center" cellpadding="2" cellspacing="1">
<!--DWLayoutTable-->
<tr><td width="1" height="18"></td>
<td width="255"></td>
<td width="114"></td>
<td width="336"></td>
<td width="72"></td>
<tr>
<td height="45"></td>
<td valign="top"> <span class="Estilo8"> Información de Cobro:</span><br>
<span class="Estilo16">Escriba los datos de cobranza.</span><br></td>
<td></td>
<td valign="top"><span class="Estilo8">Información de Envío:</span><br>
<span class="Estilo16">Escriba la dirección de envío si es diferente de la
de cobranza.</span></td>
<td> </td>
<tr>
<td height="167"></td>
<td rowspan="2" valign="top"><table border="0" cellpadding="2" cellspacing="1" width="100%">
<!--DWLayoutTable-->
<tr>
<td width="104" height="26" align="right" valign="top">
<div align="left">Nombre: </div></td>
<td width="144" valign="top">
<input type="text" size="20" name="01-C-NOMBRE"> </td>
</tr>
<tr>
<td height="26" align="right" valign="top"><div align="left">Dirección: </div></td>
<td valign="top">
<input type="text" size="20" name="02-C-DIRECCION"> </td>
</tr>
<tr>
<td height="26" align="right" valign="top" nowrap><div align="left">Ciudad: </div></td>
<td valign="top" nowrap>
<input type="text" size="20" name="03-C-CIUDAD"> </td>
</tr>
<tr>
<td height="26" align="right" valign="top"><div align="left">Estado: </div></td>
<td valign="top">
<input type="text" size="20" name="04-C-ESTADO"> </td>
</tr>
<tr>
<td height="26" align="right" valign="top"><div align="left">Código Postal: </div></td>
<td valign="top">
<input type="text" size="20" name="05-C-CODIGOP"> </td>
</tr>
<tr>
<td height="26" align="right" valign="top"><div align="left">País: </div></td>
<td valign="top">
<input type="text" size="20" name="06-C-PAIS" value="Venezuela"> </td>
</tr>
<tr>
<td height="26" align="right" valign="top"><div align="left">Teléfono: </div></td>
<td valign="top">
<input type="text" size="20" name="07-C-TELEFONO"> </td>
</tr>
<tr>
<td height="26" align="right" valign="top"><div align="left">Email: </div></td>
<td valign="top">
<input type="text" size="20" name="08-C-EMAIL"> </td>
</tr>
</table></td>
<td></td>
<td valign="top"><table border="0" cellpadding="2" cellspacing="1" width="100%">
<!--DWLayoutTable-->
<tr>
<td width="92" height="26" align="right" valign="top"><div align="left">Nombre: </div></td>
<td width="193" valign="top"><input type="text" size="20" name="09-E-NOMBRE"></td>
</tr>
<tr>
<td height="26" align="right" valign="top"><div align="left">Dirección: </div></td>
<td valign="top"><input type="text" size="20" name="10-E-DIRECCION"></td>
</tr>
<tr>
<td height="26" align="right" valign="top" nowrap><div align="left">Ciudad: </div></td>
<td valign="top" nowrap><input type="text" size="20" name="11-E-CIUDAD"></td>
</tr>
<tr>
<td height="26" align="right" valign="top"><div align="left">Estado: </div></td>
<td valign="top"><input type="text" size="20" name="12-E-ESTADO"></td>
</tr>
<tr>
<td height="26" align="right" valign="top"> <div align="left">Codigo Postal: </div></td>
<td valign="top"><input type="text" size="20" name="13-E-CODIGOP"></td>
</tr>
<tr>
<td height="26" align="right" valign="top"><div align="left">País: </div></td>
<td valign="top"><input type="text" size="20" name="14-E-PAIS"></td>
</tr>
</table></td>
<td> </td>
<table width="800" border="0" bgcolor="#FFFFFF" align="center">
<tr bgcolor="#000066" class="tit">
<td colspan="10">Información del Pago:</td></tr>
<td height="50" colspan="5" valign="top"><div align="left" class="h1 Estilo6 Estilo9">NOTA: Usted recibirá vía Email una copia de su factura junto con las instrucciones de pago por medio de un depósito bancario.</div></td>
</table> </table>
</table>
</table>
<?php }else{ ?><?php }?>
<td></td>
<td></td>
<td></td>
</table><table width="800" height="50" border="0" bgcolor="#FFFFFF" align="center">
<tr bgcolor="#000066" class="tit">
<td colspan="10">Envíe su Pedido:</td></tr>
<td height="25" td colspan="3" align="center">
<br />
<form name="mail" method="post" action="">
<input type="submit" name="mail" value="Enviar mi Pedido">
</form>
</td>
</table>
este es la pagina que me muestra el carrtio y que contiene el formulario