Hola que tal gente ? mi problema como de muchos vi es con el tema de session_start(); pero intente de TODO ! y no lo puedo solucionar, el error es el siguiente.
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\AppServ\www\FloresDany\paginas\Form.php:1) in C:\AppServ\www\FloresDany\paginas\Form.php on line 2
Les comento, en mi web hay un carrito de ventas al realizar el pedido lleva a Form.php que es donde comienza el error, obviamente el carrito lleva session_start(); sin eso no funcionaria. luego de completar la informacion lleva a un Form2.php. el codigo es el siguiente, por favor ayudenme :(
Código:
<?
session_start();
@ini_set('display_errors','1');
if(isset($_SESSION['carro']))
$carro = $_SESSION['carro'];else $carro=false;
// Si se da click en envio chequea que los campos sean validos, de lo contrario aparece mensaje de error
if ($enviar) {
$_SESSION['NombreR'] = $_POST['NombreR'];
$_SESSION['CityR'] = $_POST['CityR'];
$_SESSION['CountryR'] = $_POST['CountryR'];
$_SESSION['Email'] = $_POST['Email'];
$_SESSION['TelR'] = $_POST['TelR'];
header('Location: Form2.php');
}
?>
<!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" />
<link rel="stylesheet" href="../style/form.css" type="text/css" />
<link rel="stylesheet" href="../style/Carrito.css" type="text/css" />
<title>Flores Dany | Formulario de Envio</title>
<script language="javascript" src="../js/validacion.js"></script>
</head>
<body>
<div id="sx-Content">
<div id="sx-Head">
<div class="LogoI"></div>
<div class="LogoD"></div>
</div>
<div id="sx-Advert">
<div class="Advert">
<strong>TODOS LOS PRECIOS SON MAS IVA</strong><br />
Realice su pedido por internet, completando el formulario<br />
Las entregas se realizan de Lunes a Sábado<br />
Las ordenes se toman con una anticipación de 24 Hs. <br />
</div>
</div>
<?
if($carro) {
?>
<table border="0" style="border:1px #6393df solid;" cellspacing="0" cellpadding="3" align="center">
<tr class="backCarritoForm">
<td width="317">Producto</td>
<td width="97" align="center" valign="middle">Precio</td>
<td align="center" valign="middle">Cantidad de Unidades</td>
</tr>
<?php
$color=array("#ffffff","#F0F0F0");
$contador=0;
$suma=0;
foreach($carro as $k => $v){
$subto=$v['cantidad']*$v['precio'];
$suma=$suma+$subto;
$contador++;
?>
<tr bgcolor="<?php echo $color[$contador%2]; ?>" class='colorProductos'>
<td><?php echo $v['titulo'] ?> <strong>ID: <? echo $v['id_producto']; ?></strong></td>
<td align="center" valign="middle">$ <?php echo $v['precio'] ?></td>
<td align="center" valign="middle"><?php echo $v['cantidad'] ?></td>
</tr>
<?
}
?>
<tr class="colorCarrito">
<td align="right" valign="middle"><strong>TOTAL</strong></td>
<td align="center" valign="middle"><strong>$ <?php echo number_format($suma,2); ?></strong></td>
<td align="center" valign="middle"><strong><?php echo count($carro); ?></strong></td>
</tr>
</table>
<div align="center">
<a href="../index.php?id=Productos<?php echo SID;?>"><img src="../images/Agregar_Producto.jpg" alt="Agregar otro Producto" border="0" /></a>
<a href="../index.php?id=ShowCart<?php echo SID;?>"><img src="../images/Volver_Pedido.jpg" alt="Volver" border="0" /></a>
</div>
<form onSubmit="return ValidarFormDP()" name="DP" action="" method="post">
<table height="278" border="0" cellpadding="3" cellspacing="3" id="sx-Form">
<tr>
<td colspan="2" height="28" align="center" valign="middle">
<h3>Paso 1 / 3</h3>
</td>
</tr>
<tr>
<td height="28" colspan="2" align="center" valign="middle">
<h3>Datos Remitentes</h3>
</td>
</tr>
<tr>
<td height="36" align="right" valign="middle">
<div class="FontForm">
Nombre y Apellido :<br />
<span class="FontIngles">Name:</span> </div> </td>
<td align="left" valign="middle">
<div><input value="<? echo $NombreR; ?>" type="text" style="border:3px #edf7ff solid; width:200px;" name="NombreR" />
</div></td>
</tr>
<tr>
<td height="36" align="right" valign="middle">
<div class="FontForm">
Localidad y Provincia :<br />
<span class="FontIngles">City and State :</span> </div> </td>
<td align="left" valign="middle">
<div><input type="text" value="<? echo $CityR; ?>" style="border:3px #edf7ff solid; width:200px;" name="CityR" />
</div> </td>
</tr>
<tr>
<td height="36" align="right" valign="middle">
<div class="FontForm">
País :<br />
<span class="FontIngles">Country :</span> </div> </td>
<td align="left" valign="middle">
<div><input type="text" value="<? echo $CountryR; ?>" style="border:3px #edf7ff solid; width:200px;" name="CountryR" />
</div> </td>
</tr>
<tr>
<td height="37" align="right" valign="middle">
<div class="FontForm">
E-mail :<br />
<span class="FontIngles">E-Mail</span><br />
</div> </td>
<td align="left" valign="middle">
<div><input type="text" value="<? echo $Email; ?>" style="border:3px #edf7ff solid; width:200px;" name="Email" />
</div> </td>
</tr>
<tr>
<td height="36" align="right" valign="middle">
<div class="FontForm">
Teléfono/Fax :<br />
<span class="FontIngles">Telephone/Fax :</span> </div> </td>
<td align="left" valign="middle">
<div><input type="text" value="<? echo $TelR; ?>" style="border:3px #edf7ff solid; width:200px;" name="TelR" />
</div> </td>
</tr>
<tr>
<td colspan="2" align="center" valign="top">
<input type="submit" value="Continuar" style="background-color:#edf7ff; border:3px #d3edfe solid;" name="enviar" />
<input type="reset" value="Borrar" style="background-color:#edf7ff; border:3px #d3edfe solid;" name="Reset" />
</td>
</tr>
</table>
</form>
<?
}
else
{
?>
<p align="center"> <span style="font-family:Verdana; font-size:12px;">No hay productos seleccionados</span> <a href="../index.php"><img src="../images/continuar.gif" width="13" height="13" border="0" /></a>
<?
}
?>
<div id="sx-Footer">
<div class="FotI"></div>
<div class="tarjetas"></div>
</div>
</div>
</body>
</html>