Ver Mensaje Individual
  #1 (permalink)  
Antiguo 12/05/2008, 09:03
xeron
 
Fecha de Ingreso: mayo-2008
Mensajes: 10
Antigüedad: 18 años, 5 meses
Puntos: 0
Problema al enviar una fecha por GET

Hola! Nada primero deciros que me estoy iniciando en el tema de PHP. La duda que tengo es que cuando quiero enviar una fecha en formato dd/mm/yyyy a otra pagina no consigo hacerlo, me sigue saliendo en formato sql. :

Os lo muestro:

Código PHP:
<?php require_once('../Connections/BDreservas.php'); ?>
<?php

$hoy 
= date("d/m/Y");

function 
cambiaf_a_normal($fecha) /*funcion para convertir la fecha de formato americano a europeo */
{
    
ereg( "([0-9]{2,4})/([0-9]{1,2})/([0-9]{1,2})", $fecha, $mifecha);
    
$lafecha=$mifecha[3]."/".$mifecha[2]."/".$mifecha[1];
    return 
$lafecha;
}

if (!
function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch (
$theType) {
    case 
"text":
      
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case 
"long":
    case 
"int":
      
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case 
"double":
      
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case 
"date":
      
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case 
"defined":
      
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return 
$theValue;
}
}

if ((isset(
$_GET['id_aulas'])) && ($_GET['id_aulas'] != "") && (isset($_GET['id_turno'])) && ($_GET['id_turno'] != "") && (isset($_GET['fecha'])) && ($_GET['fecha'] != "")) 
{
  
$deleteSQL = sprintf("DELETE FROM reservas WHERE id_aulas=%s AND id_turno=%s AND fecha=%s",
                       
GetSQLValueString($_GET['id_aulas'], "int"),
                       
GetSQLValueString($_GET['id_turno'], "int"),
                       
GetSQLValueString($_GET['fecha'], "date"));

  
mysql_select_db($database_BDreservas, $BDreservas);
  
$Result1 = mysql_query($deleteSQL, $BDreservas) or die(mysql_error());

  
$deleteGoTo = "calendario.php?id_aulas=".$_GET['id_aulas']."&fecha=".cambiaf_a_normal(date("d/m/Y", $hoy));
  if (isset(
$_SERVER['QUERY_STRING'])) 
  {
    
$deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
    
$deleteGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s", $deleteGoTo));
}
?>
En el siguiente apartado es dnd tengo el problema, que es que no se si lo estoy pasando bien, x lo demas todo me va bien.

Código PHP:
$deleteGoTo = "calendario.php?id_aulas=".$_GET['id_aulas']."&fecha=".cambiaf_a_normal(date("d/m/Y", $hoy)); 
Espero vuestra respuesta, Muchas Gracias de antemano.