Ver Mensaje Individual
  #12 (permalink)  
Antiguo 06/02/2012, 10:24
Avatar de cpujades
cpujades
 
Fecha de Ingreso: agosto-2011
Mensajes: 40
Antigüedad: 12 años, 8 meses
Puntos: 0
Respuesta: problemas con fechas al quitar calendario

Al final creo que lo he conseguido haciendo " a mi manera" pongo el código a ver que os parece... igual es malo a rabiar y me gustaría le sacais pegas (por dios tampoco me hagais llorar ahora )
La parte del formulario (tengo que poner bien tamaños y demás):
Cita:

echo "<form name='calendario' method='post' action='guardarfechas.php'>";
echo "<input type='text' name='fecha' value='$fecha' size='10'>";
echo "<input type='submit' value='ok'>";
echo "Fecha Entrega Prevista";
echo "<input type='text' name='fecha2' value='$fecha2' size='10'>";
echo "<input type='submit' value='ok'>";
Donde graba las fechas:

Cita:
<?php
session_start();

include_once "conexion.php";

$fecha = $_POST["fecha"];
$fecha2 = $_POST["fecha2"];
$ipw = $_SESSION["ipw"];

function cambiarFormatoFecha($fecha){
list($anio,$mes,$dia)=explode("/",$fecha);
return $dia."-".$mes."-".$anio;
}
if($fecha!="")
{
$fecha = cambiarFormatoFecha($fecha);
$sql="UPDATE pediweb_cab SET fecha = '$fecha' WHERE id_pediweb_cab = $ipw";
conexion($sql);
}

if ($fecha2!="")
{
$fecha2 = cambiarFormatoFecha($fecha2);
$sql="UPDATE pediweb_cab SET fecentrega = '$fecha2' WHERE id_pediweb_cab = $ipw";
conexion($sql);
}

?>

<script>
window.location.href = "nuevo_pedido.php?ped=2";
</script>
__________________
El PHP me va a quitar la vida :S