1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
<?php
if(isset($_POST["conducteur"], $_POST["lieudepart"], $_POST["lieuarrive"],$_POST["participation"],$_POST["datedepart"], $_POST["datearrive"] )) {
// $order_number = NULL;
$conducteur = htmlentities($_POST['conducteur']) ;
$lieudepart = htmlentities($_POST['lieudepart']);
$lieuarrive = htmlentities($_POST['lieuarrive']);
$participation = htmlentities($_POST['participation']);
$datedepart = $_POST['datedepart'];
$datearrive = $_POST['datearrive'];
try {
$PDO = new PDO('mysql:host=localhost;dbname=philippe','root','');
$PDO->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_WARNING);
$PDO->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE,PDO::FETCH_OBJ);
$sql = "INSERT INTO orders (conducteur, lieudepart, lieuarrive, participation, datedepart, datearrive)
VALUES (:conducteur,:lieudepart,:lieuarrive,:participation,:datedepart,:datearrive)";
$req = $PDO->prepare($sql);
$PDO->query('SET foreign_key_checks = 0');
$req->execute(array(
"conducteur" => $conducteur,
"lieudepart" => $lieudepart,
"lieuarrive" => $lieuarrive,
"participation" => $participation,
"datedepart" => $datedepart,
"datearrive" => $datearrive
));
$PDO->query('SET foreign_key_checks = 1');
}
catch(Exception $e)
{
echo '.$e->getMessage().';
// die('Erreur : '.$e->getMessage());
}
echo 'Success';
} |
Partager