Send html form to SQL [closed]

1

Can someone explain to me why an HTML form does not reach the database?

I mean, I fill in the fields and when he sent me he appears

  

"Data saved correctly"

And I will update but nothing comes. I've tried with different data and it's still the same. I would greatly appreciate your input.

<?php 
$PDO = new PDO( 'mysql:host=127.0.0.1;dbname=bd_usuarios;charset=UTF8','root','123' ); 
try {
    echo "datos guardados correctamente";
    $sql=$PDO->prepare("INSERT INTO prueba1(nombre, contraseña, email, comentario) VALUES (:nombre, :contraseña, :email, :comentario)");
    $sql->bindParam(':nombre',$_POST['nombre']);
    $sql->bindParam(':contraseña',$_POST['contraseña']);
    $sql->bindParam(':email',$_POST['email']);
    $sql->bindParam(':comentario',$_POST['comentario']);
    $sql->Execute();
}catch(PDOException $e) {
    echo "Error al guardar los datos:".$e ->GetMessaje();
}
?>
    
asked by Albert Hidalgo 04.10.2018 в 23:23
source

0 answers