Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/04/2006, 05:41
Avatar de chepi
chepi
 
Fecha de Ingreso: abril-2005
Ubicación: Posadas - Misiones
Mensajes: 116
Antigüedad: 19 años
Puntos: 1
Pregunta Problema: codigo no hace nada!

Hola, antes que nada discupen el título pero no sabía que poner.
El tema es que tengo una ventana popup que se abre al hacer click en un link de un catalogo de productos. En este popup yo debo ingresar la cantidad de articulos que quiero, y así agregar al carrito. El problema es que no se bien cómo trabajar con funciones y NO ME EJECUTA NADA.
Si le pueden echar una miradita les agradecería mucho.

<?
session_start();
extract($_REQUEST);
$id = $_GET['id'];
include ("conexion.php");
$conexion= conectar();

?>
<html>
<head>
<title>PRODUCTOS AGREGADOS AL CARRITO</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<table>
<tr>
<td width="136" align="center">
<input type="text" name="cantidad" size="8">
</td>

<td align="center"> <div align="center">
<input type="submit" name="Agregar" value="Agregar" OnClick="agregar($cantidad, $id)">
</div>
</td>
</tr>
</table>
<?
function agregar($cantidad, $id)
{
if(!$cantidad)
{
$cantidad=1;
}
$qry=mysql_query("select * from perfiles where id= '$id'", $conexion)or die (mysql_error());

$row=mysql_fetch_array($qry);

$carro=$_SESSION['carro'];

$carro[md5($id)]=array('identificador'=>md5($id),'cantidad'=>$cant idad,'cod_perfil'=>$row['cod_perfil'],'id'=>$id);

$_SESSION['carro']=$carro;


echo "<script>window.opener.location.reload(); window.close();</script>";exit;
}
?>

</body>
</html>