
24/06/2008, 08:44
|
| | Fecha de Ingreso: abril-2008
Mensajes: 435
Antigüedad: 16 años, 10 meses Puntos: 10 | |
Ayuda con carrito de compras Hola de nuevo!!!
Estoy haciendo un carrito de compras con PHP, los datos de los productos los traigo de una base de datos, la idea es con el tiempo ir agregando productos a traves de un formulario.
Bien la cosa es que cuando traigo los datos a una tabla con un while me tomo la primera fila dentro de la tabla de manera correcta, pero de ahi para abajo me deja los demas productos fuera de la tabla y no entiendo porque.
les dejo el codigo
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin título</title>
<link href="estilos.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.Estilo3 {color: #FFFFFF; font-weight: bold;}
-->
</style>
</head>
<body>
<?php
include ("connect.php");
?>
<div id="contenedor">
<div id="barra"><table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="40"> </td>
<td width="90"><span class="Estilo3"><a href="index.html">Inicio</a></span></td>
<td width="106"><span class="Estilo3"><a href="historia.html">Historia</a><a href="personajes.html"></a></span></td>
<td width="128"><span class="Estilo3"><a href="personajes.html">Personajes</a><a href="sistema.html"></a></span></td>
<td width="109"><span class="Estilo3"><a href="imagenes.html">Imagenes</a></span></td>
<td width="117"><span class="Estilo3"><a href="comentarios.html">Comentarios</a></span></td>
<td width="110"><span class="Estilo3"><a href="comprar.html">Comprar</a></span></td>
</tr>
</table>
</div>
<div id="marcosup"></div>
<div id="contenido">
<form action="" method="post" name="formcompras" id="formcompras">
<?php
$consulta = mysql_query ("SELECT * FROM productos", $conexion);
?>
<table border="2" cellspacing="0" cellpadding="0" class="Estilo3">
<tr>
<td width="60" align="center" bgcolor="#6699CC">Codigo</td>
<td width="180" align="center" bgcolor="#6699CC">Producto</td>
<td width="60" align="center" bgcolor="#6699CC">Precio</td>
<td width="50" align="center" bgcolor="#6699CC">Stock</td>
<td width="70" align="center" bgcolor="#6699CC">Comprar</td>
<td width="70" align="center" bgcolor="#6699CC">Cantidad</td>
</tr>
<?php
while ($row = mysql_fetch_row($consulta)) {
?>
<tr>
<td align="center"><?php echo $row[0]; ?></td>
<td align="center"><?php echo $row[1]; ?></td>
<td align="center"><?php echo $row[2]; ?></td>
<td align="center"><?php echo $row[3]; ?></td>
<td align="center"><input name="b.$row[0]" type="checkbox" id="b.$row[0]" /></td>
<td align="center"><input name="c.$row[0]" id="c.$row[0]" type="text" maxlength="3" size="3"/></td>
</tr>
</table>
</form>
<?php
}
mysql_close();
?>
</div>
<div id="marcoinf"></div>
<div id="pie"><table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="70" height="130"> </td>
<td width="200" align="center"><img src="imagenes/vp2logo.jpg" width="132" height="68" /></td>
<td width="230" align="center"><img src="imagenes/square_logo.jpg" width="200" height="68" /></td>
<td width="200" align="center"><img src="imagenes/playstation2logo.jpg" width="166" height="68" /></td>
</tr>
</table>
</div>
</div>
</body>
</html>
Otra duda que tengo es si le puedo dar a una casilla de texto como nombre una variable de php
espero me puedan ayudar
gracias de antemano |