Tengo variables que se obtienen las obtengo de una pagina, con el GET las saco del input type text, y despues creo variable session para tener una variable global, pero al momento de llevarla a otra pagina me marca que no existe.
Con esto quiero llenar una tabla en SQL, pero las variables de cantidad y precio son las que se me estan complicando debido a que las estoy dando paginas antes mientras las otras(Nombre,ID,etc) las doy solo una pagina antes mediante un form.
PAGINA DONDE SE CREA:
input type="color" name="color" />
<p>
<form action="Registro.php" >
CANTIDAD <input type="text" name="cantidad" />
</B></I></font></font> </p>
</th>
<th width="385">
<input type="submit" name="Agregar1" value="AGREGAR" /></form>
</th>
</table>
</div>
<br />
<br />
</div>
<div id="cinco">
<table width="1056">
<th width="312">
<img src="p3.jpg" width="200" height="200"/>
</th>
<th width="343">
<font face="arial"> <font color="#FFFFFF"> <I> <B> COLOR FAVORITO </B></I></font></font>
<input type="color" name="color" />
<p>
<form action="Registro.php" method="post">
CANTIDAD <input type="text" name="Cantidad" />
</B></I></font></font> </p>
</th>
<th width="385">
<input type="submit" name="Agregar2" value="AGREGAR" /></form>
</th>
</table>
</div>
<br />
<br />
</div>
<div id="seis">
<table width="1056">
<th width="312">
<img src="imagen3.jpg" width="200" height="200"/>
</th>
<th width="343">
<font face="arial"> <font color="#FFFFFF"> <I> <B> COLOR FAVORITO </B></I></font></font>
<input type="color" name="color" />
<p>
<form action="Registro.php" method="post">
CANTIDAD <input type="text" name="cantidad" />
</B></I></font></font> </p>
</th>
<th width="385">
<input type="submit" name="Agregar3" value="AGREGAR" /></form>
</th>
</table>
<br />
<br />
<br />
</div>
</body>
<?php
session_start();
ob_start();
$_SESSION['cantidad']=($_GET['cantidad']);
if(isset($_POST['Agregar1']))
{
$_SESSION['precio']=500;
}
if(isset($_POST['Agregar1']))
$_SESSION['precio']=600;
if(isset($_POST['Agregar1']))
$_SESSION['precio']=200;
?>
PAGINA DONDE LA RECIBE:
<?php
session_start();
ob_start();
include("Conexion.php");
$id=$_GET['Id'];
$nombre=$_GET['Nombre'];
$cantidad=$_SESSION['cantidad'];
$apellido=$_GET['Apellido'];
$email=$_GET['Email'];
$telefono=$_GET['Telefono'];
$pais=$_GET['Pais'];
$ciudad=$_GET['Ciudad'];
$precio=$_SESSION['precio'];
$total=$precio*$cantidad;
if($total<1500)
{
$ttotal=$total;
}
else
{
$ttotal=$total+400;
}
$direccion=$_GET['Direccion'];
$insertar = "insert into Tienda (ID_Compra,Cantidad,Nombre,Apellido,Email,Telefono,Pais,Ciudad,Direccion,Total)
values ('$id','$nombre','$cantidad','$apellido','$email','$telefono','$pais','$ciudad','$direccion','$ttotal)";