Mogurbon, gracias por intentar ayudarme. Ahí van los códigos.
control.php tiene esto
Código:
$conexion = mysql_connect ($host, $user, $pass);
mysql_select_db ($base, $conexion);
$sql="SELECT cli.id from pactemos_clientes cli
where cli.user='$usuario' and cli.pass='$contrasena'";
$result = mysql_query($sql, $conexion);
while ($row=mysql_fetch_array($result))
{
$id_cliente=$row['id'];
}
if ($id_cliente!="")
{
session_start();
$_SESSION["sesion"]= "SI";
if ($id!="") { $_SESSION["id"]= $id; }
if ($ocupantes!="") { $_SESSION["ocupantes"]= $ocupantes; }
if ($localidad!="") { $_SESSION["localidad"]= $localidad; }
if ($id_unidad!="") { $_SESSION["id_unidad"]= $id_unidad; }
if ($id_cliente!="") { $_SESSION["id_cliente"]= $id_cliente;}
if ($fecha_desde!="") { $_SESSION["fecha_desde"]= $fecha_desde; }
if ($fecha_hasta!="") { $_SESSION["fecha_hasta"]= $fecha_hasta; }
header ("Location: $pagina.php");
}
else
{
session_start();
if ($id!="") { $_SESSION["id"]= $id; }
if ($ocupantes!="") { $_SESSION["ocupantes"]= $ocupantes; }
if ($localidad!="") { $_SESSION["localidad"]= $localidad; }
if ($id_unidad!="") { $_SESSION["id_unidad"]= $id_unidad; }
if ($id_cliente!="") { $_SESSION["id_cliente"]= $id_cliente;}
if ($fecha_desde!="") { $_SESSION["fecha_desde"]= $fecha_desde; }
if ($fecha_hasta!="") { $_SESSION["fecha_hasta"]= $fecha_hasta; }
header ("Location: $pagina.php?errorusuario=si");
//si no existe le mando otra vez a la portada
}
como no podía dormir, le agregué los "if" por si servía de algo, que si la variable esté vacía,no la genere... pero sigue igual.
a todo esto, tengo el formulario
Código:
<form action="reservar.php" name="formulario" method="post" enctype="multipart/form-data">
<input type="hidden" name="ocupantes" value="<?php echo $ocupantes; ?>"/>
<input type="hidden" name="id_unidad" value="<?php echo $id_unidad; ?>"/>
<div id="formu_reserve">
<table width="100%" border="0">
<tr>
<td width="50%">Llegada</td>
<td width="50%">Salida</td>
</tr>
<tr>
<td><?php if ($fecha_desde!="") {?>
<input type="text" value="<?php echo $fecha_desde; ?>" name="fecha_desde" id="from" class="formu_contacte_input"/>
<?php } else {?>
<input type="text" value="<?php echo $hoy_barra; ?>" name="fecha_desde" id="from" class="formu_contacte_input"/>
<?php } ?></td>
<td><?php if ($fecha_hasta!="") {?>
<input type="text" id="to" value="<?php echo $fecha_hasta; ?>" name="fecha_hasta" class="formu_contacte_input"/>
<?php } else {?>
<input type="text" value="dd/mm/2011" name="fecha_hasta" id="to" class="formu_contacte_input"/>
<?php } ?></td>
</tr>
<tr>
<td colspan="2"><div align="right"><input type="image" src="elementos/boton_formu_reservar.jpg" name="Submit" width="113" height="19" /></div></td>
</tr>
</table>
</div></form>
y en reservar.php no me llegan las variables (comienza con <?php session_start(); ?>).