esto es loq ue estoy haciendo... he puesto el heder en distintos lados de la pagina y me sale lo mismo...
Código PHP:
<?php
session_start();
?>
<html>
<title>Sistema de Inventario</title>
<meta http-equiv="Content-Language" content="English" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="css/style.css" media="screen" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="wrap">
<div id="header">
<h1><center>SISTEMA DE CONTROL Y SEGUIMIENTO <br /><br /><br /> DE SUMINISTROS DE OFICINA</h1></center>
</div> <br />
<div id="top"> </div>
<div id="content">
<script language="javascript">
function fAgrega()
{
document.getElementById("Text2").value = document.getElementById("Text1").value;
}
</script>
<?php
include("conexion/conexion.php");
$usuario= $_SESSION["user"];
?>
<center>
RESPONSABLE:<input type="hidden" name="nombres" >
<option > <?php echo "$usuario" ;?></option>
<div id="derecha">
<h1></h1>
<div class='text-border'>
<?php
if (isset($_GET['id']))
$id = $_GET['id'];
else
$id = 1;
if (isset($_GET['action']))
$action = $_GET['action'];
else
$action = "empty";
switch($action){
case "add":
if(isset($_SESSION['carro'][$id]))
$_SESSION['carro'][$id]++;
else
$_SESSION['carro'][$id]=1;
break;
case "remove":
if(isset($_SESSION['carro'][$id]))
{
$_SESSION['carro'][$id]--;
if($_SESSION['carro'][$id]==0)
unset($_SESSION['carro'][$id]);
}
break;
case "removeProd":
if(isset($_SESSION['carro'][$id])){
unset($_SESSION['carro'][$id]);
}
break;
case "mostrar":
if(isset($_SESSION['carro'][$id])){
continue;
}
break;
case "empty":
unset($_SESSION['carro']);
break;
}
if(isset($_SESSION['carro'])){
echo " <table border=0 cellspacing=5 cellpadding=5 width='700'>";
//Inicializamos el contador de productos seleccionados.
echo "<tr>";
echo "<td><b>cod. Producto</td>";
echo "<td><b>Productos</td>";
echo "<td><b>Cantidad</td>";
echo "<td><b>Accion</td>";
echo "<td colspan=2><b>Stock</td>";
echo "</tr>";
echo "<tr><td colspan=5><hr></td></tr>";
foreach($_SESSION['carro'] as $id => $x){
$resultado = mysql_query("select idsuministros , nomsuministros, unidades, departamento FROM suministros, users WHERE idsuministros='$id'");
$mifila = mysql_fetch_array($resultado);
$cod = $mifila['idsuministros'];
$producto = $mifila['nomsuministros'];
//acortamos el nombre del producto a 40 caracteres
$producto = substr($producto,0,40);
$precio = $mifila['unidades'];
//Coste por art�culo seg�n la cantidad elegida
$coste = $precio - $x;
//Coste total del carro
$fecha=date("y-m-d");
$canti="cantidad";
$estado="I";
//Contador del total de productos a�adidos al carro
// $Total = $Total + $x;
?>
?>
<tr>
<form action ="carro.php" method="post" name="carro" id="carro" action="carro.php">
<td><input type="hidden" name="cod" size="1" >
<option > <?php echo "$cod" ;?> </option>
<td><input type="hidden" name="produ" size="1" >
<option > <?php echo "$producto" ;?> </option>
<td><input type="hidden" name="cantidad" id="cantidad" size="1"/>
<option > <?php echo "$x" ;?> </option>
<td><input type="hidden" name="depar" >
<option > <?php echo "$depar" ;?></option>
<input type="hidden" name="estado" value=" <?php echo "$estado" ;?>" >
</form>
<td >
<?php
echo"<a href='carro.php?id=". $id ."&action=add'><img src='images/carrito/aumentar.png' stle='padding:0 0px 0 5px;' alt='Aumentar cantidad' /></a>";
if ($x > 0)
echo "<a href='carro.php?id=". $id ."&action=remove'><img src='images/carrito/restar.png' alt='Reducir cantidad' ></a>";
else
echo "<a href='carro.php?id=". $id ."&action=removeProd'><img src='images/carrito/eliminar.png' alt='Eliminar cantidad' /></a></td>";
echo "<td align='right'> </td>";
echo "<td style='margin-left:10px'>$coste Cant.";
echo "</tr>";
echo "";
}
?>
<tr></tr>
</table>
<?php
$xx=mysql_query("insert into detallepedido VALUES ('$id_pedido', '$fecha','$cod', '$producto','$x','$usuario', '$estado')",$con);
$xxx="update detallepedido set cantidad='$x' where id_pedido= '$id_pedido'" ;
$ac=mysql_query($xxx,$con);
$resp=mysql_query($xx,$con);
$state = true;
header('location: carro.php');
exit();
}
?>