![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
01/07/2010, 21:24
|
| | Fecha de Ingreso: mayo-2010
Mensajes: 60
Antigüedad: 14 años, 8 meses Puntos: 0 | |
[Ayuda]Sistema de Consulta de Zapatos Hola amigos.! Disculpa la molestia, les cuento que tengo un grave problema con un sistema de zapateria que necesito hacer... El problema es el siguiente:
Dada una marca y una talla, tiene que devolver todos los modelos relacionados a esa marca y todas las cantidades relacionadas a esa talla con sus respectivos modelos. Ejemplo:
INDEX
[URL=http://img594.imageshack.us/i/pantalla1.jpg/][IMG]http://img594.imageshack.us/img594/3412/pantalla1.jpg[/IMG][/URL]
PANTALLA DESPUES DE LA CONSULTA
[URL=http://img257.imageshack.us/i/pantalla2.jpg/][IMG]http://img257.imageshack.us/img257/1179/pantalla2.jpg[/IMG][/URL]
Les cuento con que me estoy matando el coco... Es en la parte de los arreglos de como puedo traer esos 2 valores ( modelos de esa marca y sus respectivas cantidades... yo se como traer la cantidad sola, trae todos los modelos con sus respectivas cantidades no :(
Aca les dejo mi trabajo para que cheken hasta donde he llegado y si me pueden dar un consejo de como traer esos valores de modelos con sus respectiva talla que es lo que me falta para hacer el sistema completo. Muchas Gracias
index.php
Código:
<html>
<head>
<title>Sistema de Zapateria</title>
</head>
<body>
<center>
<h1>Sistema de Consultas de Zapatos</h1></center>
<hr>
<br />
<center>
<form name="datos" action="zapatos.php" method="post">
<table width="157" border="0">
<tr>
<td width="64"><strong>MARCA</strong></td>
<td width="77"><select name="marca" id="marca" style="width: 100px">
<option value="0">Seleccione...</OPTION>
<option value="nike1">nike1</option>
<option value="nike2">nike2</option>
<option value="nike3">nike3</option>
<option value="puma1">puma1</option>
<option value="puma2">puma2</option>
<option value="puma3">puma3</option>
<option value="zara1">zara1</option>
<option value="zara2">zara2</option>
<option value="zara3">zara3</option>
</select></td>
</tr>
<tr>
<td height="26"><strong>TALLA</strong></td>
<td><select name="talla" id="talla" style="width: 100px">
<option value="0">Seleccione...</OPTION>
<?php
for($i=35; $i<=40; $i++){
echo "<option value='".$i."'>".$i."</option>";
}
?>
</select></td>
</tr>
</table>
<br>
<input type="submit" name="consultar" id="consultar" value="Consultar">
</form>
</center>
</body>
</html>
zapatos.php
Código:
<html>
<head>
<title>Consulta de Zapatos</title>
</head>
<body>
<?php
include ("classDatos.php");
include("classtabla.php");
$marca=$_POST['marca'];
$talla=$_POST['talla'];
?>
<center>
<h1>Sistema de Consultas de Zapatos</h1>
<hr>
<h2>MARCA:
<?php echo $_POST['marca']?> - TALLA:
<?php echo $_POST['talla'] ?>
</h2></center>
<hr>
<?php
if(!$marca or !$talla){
echo "<br><center><b>Debes llenar la consulta completa.</b><br><br>";
echo "<a href='index.php'><input type='button' name='volver' value='Volver'></a></center>";
}
else {
echo "<br />";
echo "<br />";
echo "<center>";
$tabla1=new Tabla(2,3);
$tabla1->cargar(1,1,"<b>Marca</b>");
$tabla1->cargar(1,2,"<b>Talla</b>");
$tabla1->cargar(1,3,"<b>Cantidad</b>");
$tabla1->cargar(2,1,$_POST['marca']);
$tabla1->cargar(2,2,$_POST['talla']);
$tabla1->cargar(2,3,$cantidad[$_POST['marca']][$_POST['talla']]);
$tabla1->graficar();
echo "<br />";
echo "<A href='index.php'><INPUT type='button' name='volver' value='Volver'></A></CENTER>";
echo "</center>";
}
?>
</body>
</html>
classDatos.php
Código:
<?php
$cantidad = array (
'nike1' => array (
'35' => '22',
'36' => '5',
'37' => '4',
'38' => '6',
'39' => '32',
'40' => '21'
),
'nike2' => array (
'35' => '10',
'36' => '25',
'37' => '34',
'38' => '46',
'39' => '17',
'40' => '29'
),
'nike3' => array (
'35' => '22',
'36' => '33',
'37' => '11',
'38' => '26',
'39' => '47',
'40' => '19'
),
'puma1' => array (
'35' => '44',
'36' => '32',
'37' => '14',
'38' => '36',
'39' => '32',
'40' => '49'
),
'puma2' => array (
'35' => '15',
'36' => '45',
'37' => '14',
'38' => '56',
'39' => '37',
'40' => '29'
),
'puma3' => array (
'35' => '30',
'36' => '25',
'37' => '34',
'38' => '16',
'39' => '17',
'40' => '29'
),
'zara1' => array (
'35' => '12',
'36' => '15',
'37' => '14',
'38' => '46',
'39' => '37',
'40' => '29'
),
'zara2' => array (
'35' => '13',
'36' => '15',
'37' => '14',
'38' => '16',
'39' => '37',
'40' => '29'
),
'zara3' => array (
'35' => '20',
'36' => '22',
'37' => '19',
'38' => '18',
'39' => '15',
'40' => '11'
),
);
?>
classTabla.php
Código:
<?php
class Tabla {
private $mat=array();
private $cantFilas;
private $cantColumnas;
public function __construct($fi,$co)
{
$this->cantFilas=$fi;
$this->cantColumnas=$co;
}
public function cargar($fila,$columna,$valor)
{
$this->mat[$fila][$columna]=$valor;
}
public function inicioTabla()
{
echo '<table border="1 ">';
}
public function inicioFila()
{
echo '<tr>';
}
public function mostrar($fi,$co)
{
echo '<td>'.$this->mat[$fi][$co].'</td>';
}
public function finFila()
{
echo '</tr>';
}
public function finTabla()
{
echo '</table>';
}
public function graficar()
{
$this->inicioTabla();
for($f=1;$f<=$this->cantFilas;$f++)
{
$this->inicioFila();
for($c=1;$c<=$this->cantColumnas;$c++)
{
$this->mostrar($f,$c);
}
$this->finFila();
}
$this->finTabla();
}
}
?>
|