Ver Mensaje Individual
  #7 (permalink)  
Antiguo 10/06/2008, 12:09
Avatar de xxrandyxx
xxrandyxx
 
Fecha de Ingreso: abril-2008
Ubicación: En mi casa
Mensajes: 143
Antigüedad: 16 años
Puntos: 2
Respuesta: Ayuda con Codigo Extraño

Te dejo mis codigos


Este es de mi seccion de productos


Código:
<?php // [email protected]
session_start();  
session_register('itemsEnCesta');  
$item=$_POST['item'];  
$cantidad=$_POST['cantidad'];  
$itemsEnCesta=$_SESSION['itemsEnCesta'];  
if ($item){  
   if (!isset($itemsEnCesta)){  
      $itemsEnCesta[$item]=$cantidad;  
   }else{  
      foreach($itemsEnCesta as $k => $v)
	        foreach($itemsEnCesta as $k => $v){  
         if ($item==$k){  
         $itemsEnCesta[$k]+=$cantidad;  
         $encontrado=1;  
         }  
      }  
      if (!$encontrado) $itemsEnCesta[$item]=$cantidad;  
   }  
}  
$_SESSION['itemsEnCesta']=$itemsEnCesta; 
?>

Siguiendo esto mas abajo, claro toy dando sin html

Código:
<form action="<?=$PHP_SELF."?".$SID?>" method="post">
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td align="center"><span class="text4sinspace">Codigo del Producto</span></td>
                    </tr>
                    <tr>
                      <td align="center"><span class="text4sinspace">
                        <input name="item" type="text" class="texto_red_black" id="item" value="<?php echo $row_rs_detalles_stock['item']; ?>" size="5" maxlength="10">
                      </span></td>
                    </tr>
                    <tr>
                      <td align="center">&nbsp;</td>
                    </tr>
                    <tr>
                      <td align="center"><span class="text4sinspace">Cuantas unidades </span></td>
                    </tr>
                    <tr>
                      <td align="center"><span class="text4sinspace">
                        <input name="cantidad" type="text" class="text4sinspace2" id="cantidad" value="1" size="5" maxlength="10">
                      </span></td>
                    </tr>
                    <tr>
                      <td align="center">&nbsp;</td>
                    </tr>
                  </table>
                  <span class="text4sinspace">
                  <input type="submit" class="text4" value="Agregar ">
                  </span><br>
              </form>

Y este es de mi carrito


Código:
<?php // Manual de PHP  
session_start();  
session_register('itemsEnCesta');  
$item=$_POST['item'];  
$cantidad=$_POST['cantidad'];  
$itemsEnCesta=$_SESSION['itemsEnCesta'];  
if ($item){  
   if (!isset($itemsEnCesta)){  
      $itemsEnCesta[$item]=$cantidad;  
   }else{  
      foreach($itemsEnCesta as $k => $v){  
         if ($item==$k){  
         $itemsEnCesta[$k]+=$cantidad;  
         $encontrado=1;  
         }  
      }  
      if (!$encontrado) $itemsEnCesta[$item]=$cantidad;  
   }  
}  
$_SESSION['itemsEnCesta']=$itemsEnCesta; 
?>  



<!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=utf-8" />
<title>INTERWATT // EL BENEFICIO DE LO DURABLE</title>
<link href="estilos/stilos.css" rel="stylesheet" type="text/css" />
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<style type="text/css">
<!--
.catalogo {font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 9px;
color: #333333;
}
-->
</style>
</head>

<body onload="scroll()">
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center" valign="top"><table width="536" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="10">&nbsp;</td>
        <td height="200" align="center" background="imagenes/degra.jpg" class="texto_gigante">LA TIENDA VIRTUAL DEL CALOR</td>
      </tr>
      <tr>
        <td height="20">&nbsp;</td>
        <td height="20" align="left"><span class="texto_black"><img src="http://www.theivyat78704.com/images/asterisk_orange.png" alt="" /> CARRITO DE COMPRAS</span></td>
      </tr>
      <tr>
        <td height="1"></td>
        <td height="1" align="left" bgcolor="#666666"></td>
      </tr>
      <tr>
        <td height="300"></td>
        <td height="300" align="center" valign="top"><tt class="text4sinspace"><br />
          <br />
          </tt>
          
          <tt class="text4sinspace"><table width="300" border="0" align="center" cellpadding="0" cellspacing="0" class="texto_gris">
            <tr>
              <td width="100" align="center" bgcolor="#CCCCCC">Codigo</td>
              <td width="100" align="center" bgcolor="#CCCCCC">Precio</td>
              <td width="100" align="center" bgcolor="#CCCCCC">Unidades</td>
              </tr>
          </table><?  
if (isset($itemsEnCesta)){  
   foreach($itemsEnCesta as $k => $v){
      echo '<table width="300" border="0" align="center" cellpadding="0" cellspacing="0" class="texto_gris">
            <tr>
              <td width="100" align="center">'.$k.'</td>
              <td width="100" align="center">'.$p.'</td>
              <td width="100" align="center">'.$v.'</td>
            </tr>
          </table>'; 
   }  

}  

else{
   echo 'Usted no ha agregado nada al carrito de compras';}
?>
                  </tt></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>

HELP!