Ver Mensaje Individual
  #12 (permalink)  
Antiguo 12/03/2010, 10:34
tallara
 
Fecha de Ingreso: enero-2009
Mensajes: 56
Antigüedad: 15 años, 3 meses
Puntos: 0
Respuesta: Enviar datos a mysql

Tal como la tengo ahora, no la toco mas asta que veais el fallo, que yo me vuelvo loco.
Código:
<?php

if ($_POST['submit']){

$Nombre = $_POST['Nombre'];
$Apellido1 = $_POST['Apellido1'];
$Apellido2 = $_POST['Apellido2'];
$Dni = $_POST['Dni'];
$Email = $_POST['Email'];
$Fechainicio = $_POST['Fechainicio'];
$Fechafin = $_POST['Fechafin'];
$Personas = $_POST['Personas'];
$Comentario = $_POST['Comentario'];

} else {

 echo "No se ha clicado el botón";

}

        $link = mysql_connect("xxxxxxxxx","xxxxxxxx","xxxxxxxx");
        mysql_select_db("qfw523",$link);

        mysql_query("INSERT INTO reservas (id, Nombre, Apellido1, Apellido2, Dni, Telefono, Email, Fechainicio, Fechafin, Personas, Comentario, Reservado, Cancelado) 
		VALUES ('', '$Nombre', '$Apellido1', '$Apellido2', '$Dni', '$Email', '$Fechainicio', '$Fechafin', '$Personas', '$Comentario', '', '')",$link);

        // Ahora comprobaremos que todo ha ido correctamente
        $my_error = mysql_error($link);

        if(!empty($my_error)) {

            echo "Ha habido un error al insertar los valores. $my_error"; 

        } else {

            echo "Los datos han sido introducidos satisfactoriamente";

    }
?>