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
| <?php
try
{
$bdd = new PDO('mysql:host=localhost;dbname=h3tc;charset=utf8', 'root', '');
$bdd->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch (Exception $ex)
{
echo 'not not connected'. $ex->getMessage();
}
if (isset($_POST['submit'])) {
# code...
$marque =$_POST['marque'];
$temps =$_POST['temps'];
$prix =$_POST['prix'];
$identif =$_POST['identif'];
$position =$_POST['position'];
$tel =$_POST['tel'];
$observ =$_POST['observ'];
$trans =$_POST['trans'];
$carbur =$_POST['carbur'];
$modele =$_POST['modele'];
$kilom =$_POST['kilom'];
echo $marque;
echo $modele;
$ret = $bdd->prepare('INSERT INTO vehicule(marque, temps, prix, identif, position, tel, observ, trans, carbur, modele, kilom)
VALUES(:marque, :temps, :prix, :identif, :position, :tel, :observ, :modele, :trans, :carbur, :kilom)');
$result=$ret->execute(array(
'marque' => $marque,
'temps' => $temps,
'prix' => $prix,
'identif' => $identif,
'position' => $position,
'tel' => $tel,
'observ' => $observ,
'trans' => $trans,
'carbur' => $carbur,
'modele' => $modele,
'kilom' => $kilom ));
include ("achat.php");
}
?> |
Partager