Código PHP:
Ver original
<?php require_once('Connections/conexionzapatos.php'); ?> <?php require_once('Connections/conexionzapatos.php'); ?> <?php function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": break; case "double": break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $editFormAction = $_SERVER['PHP_SELF']; } $insertSQL = sprintf("INSERT INTO tblcompra (idCompra, idUsuario, fchFecha, intTipoPago, dblTotal, intEstado, strNombre) VALUES (%s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['idCompra'], "int"), GetSQLValueString($_POST['idUsuario'], "int"), GetSQLValueString($_POST['fchFecha'], "date"), GetSQLValueString($_POST['intTipoPago'], "text"), GetSQLValueString($_POST['dblTotal'], "double"), GetSQLValueString($_POST['intEstado'], "int"), GetSQLValueString($_POST['strNombre'], "text")); $insertGoTo = "prueb1234.php"; $insertGoTo .= $_SERVER['QUERY_STRING']; } } $varUsuario_Datos = "0"; $varUsuario_Datos = $_SESSION["MM_IdUsuario"]; } $query_Datos = sprintf("SELECT * FROM tblcarrito WHERE tblcarrito.idUsuario = %s AND tblcarrito.intTransaccionEfectuada = 0", GetSQLValueString($varUsuario_Datos, "int")); $Transferencia="Transferencia"; $producto="strNombre"; $contador=0; $itemsEnCesta=$_SESSION['MM_IdUsuario']; $preciototal = 0; $multiplicador = ObtenerIVA()/100; $valorconIVA = $preciototal * $multiplicador; ?> </script> <script type="text/javascript" href="./js/scripts.js"></script> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <!-- InstanceBeginEditable name="doctitle" --> <title>Documento sin título</title> <!-- InstanceEndEditable --> <!-- InstanceBeginEditable name="head" --> <!-- InstanceEndEditable --> <link href="estilo/principal.css" rel="stylesheet" type="text/css" /> </head> <body> <div class="container"> <div class="header"><div class="headerinterior"><img src="images/logotrans.png" width="283" height="64" alt="Tienda Zapatos" /></div></div> <div class="subcontenedor"> <div class="sidebar1"> <?php include("includes/catalogo.php"); ?> <!-- end .sidebar1 --></div> <div class="content"> <h1><!-- InstanceBeginEditable name="Titulo" -->Carrito de la compra<!-- InstanceEndEditable --></h1> <!-- InstanceBeginEditable name="EditRegion4" --> <td><a href="eliminar_producto.php?recordID=<?php echo $row_Datos['idProducto']; ?>">vaciar</a></td> <?php if ($totalRows_Datos > 0) { // Show if recordset not empty ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr class="ver"> <td width="18%">Producto</td> <td width="44%">Unidades</td> <td width="28%">Precio Unidad</td> <td width="10%">Acciones</td> </tr> <?php $preciototal = 0;?> <?php do { ?> <tr class="letra"> <td align=""><?php echo ObtenerNombreProducto($row_Datos['idProducto']); ?></td> <td><form name="FComprar" action="carrito_add.php" method="get"><?php echo $row_Datos['intCantidad']; ?> <select name="intCantidad" id="intCantidad"> <option value="1" selected="selected">1</option><option value="2">2</option><option value="3">3</option> <option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option><option value="11">11</option><option value="12">12</option><option value="13">13</option><option value="14">14</option><option value="15">15</option><option value="16">16</option><option value="17">17</option><option value="18">18</option><option value="19">19</option><option value="20">20</option> </select><input name="recordID" type="hidden" value="<?php echo $row_Datos['idProducto']; ?>" /><input name="" type="submit" value="+" /> <select name="intCantidad" id="intCantidad"> <option value="-1">1</option> </select><input name="recordID" type="hidden" value="<?php echo $row_Datos['idProducto']; ?>" /><input name="" type="submit" value="-" /> </form> </td> <td ><?php echo ObtenerPrecioProducto($row_Datos['idProducto']); ?> <span class="letra">Euros</span></td> <td><a href="eliminar_producto.php?recordID=<?php echo $row_Datos['idProducto']; ?>">Eliminar</a></td> </tr> <?php $preciototal = $preciototal + $row_Datos['intCantidad']* ObtenerPrecioProducto($row_Datos['idProducto']);?> <tr> <td> </td> <td align="right">Subtotal:</td> <td colspan="2" align="left"> <?php $multiplicador = (100 + ObtenerIVA())/100; $valorconIVA = $preciototal * $multiplicador; echo $valorconIVA;?> </td></tr> </table> <br /> <?php } // Show if recordset not empty ?> <?php if ($totalRows_Datos == 0) { // Show if recordset empty ?> <p> <table width="363" align="center"> <tr> <td width="355" align="center">Su Carro Esta Vacio</td> </tr> </table> <?php } // Show if recordset empty ?> </p> </div> <</html> <?php ?>