Here is the code
<?php
try{
$pdo_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
$bdd = new PDO('mysql:host=localhost;dbname=test', 'root', '',$pdo_options);
$req = $bdd->prepare('INSERT INTO minichat (pseudo, message)
VALUES(?, ?)');
$req->execute(array($_POST['pseudo'], $_POST['message']));header('Location: minichat.php');
}catch(Exception $e){
die('Erreur : '.$e->getMessage());
}
?>