Código PHP:
<?php
session_start();
extract($_REQUEST);
include ('configbd.php');
if (ereg("^[0-9]+$",$cantidad)) { echo "la cantidad es numerica";
if(!isset($cantidad)){$cantidad=1;}
$formato="snack";
$qry=mysql_query("select * from snacks where id_snack='".$id."'");
$row=mysql_fetch_array($qry);
if(isset($_SESSION['carro']))
$carro=$_SESSION['carro'];
$carro[md5($id)]=array('identificador'=>md5($id),'cantidad'=>$cantidad,'nombre'=>$row['nombre_s'],'precio'=>$row[precio],'imagen'=>$row['imagen'],'formato'=>$formato,'id'=>$id);
$_SESSION['carro']=$carro;
if ($cantidad>1)
{
header("Location:".$_SERVER['HTTP_REFERER']);
}
else
{
echo '<script>history.back(-1);</script>';
}
}
else {
header("Location:".$_SERVER['HTTP_REFERER']);
}
?>
Warning: Cannot modify header information - headers already sent by (output started at car.php:5 in car.php on line 22
Saludos