38 lines
1.1 KiB
PHP
38 lines
1.1 KiB
PHP
|
<?php
|
|||
|
//require ('../connectionBD.php');
|
|||
|
//$mail = null;
|
|||
|
//$db = connexionBD();
|
|||
|
//init();
|
|||
|
|
|||
|
$matricule = isset($_POST['matricule']) ? $_POST['matricule'] : NULL; //recuperation valeur formulaire, isset pour eviter l'erreur "Notice: Undefined index"
|
|||
|
$marque = isset($_POST['marque']) ? $_POST['marque'] : NULL;
|
|||
|
$modele = isset($_POST['modele']) ? $_POST['modele'] : NULL;
|
|||
|
$nbplaces = isset($_POST['nbplaces']) ? $_POST['nbplaces'] : NULL;
|
|||
|
$anneefab = isset($_POST['anneefab']) ? $_POST['anneefab'] : NULL;
|
|||
|
|
|||
|
if(isset($_POST['submit']))
|
|||
|
{
|
|||
|
addVoiture();
|
|||
|
}
|
|||
|
|
|||
|
function init(){
|
|||
|
session_start();
|
|||
|
global $mail;
|
|||
|
//Si on est pas connecté redirection vers la page de connexion
|
|||
|
if(!isset($_SESSION['mail'])){
|
|||
|
header('Location: ../index.php');
|
|||
|
exit();
|
|||
|
}
|
|||
|
else{
|
|||
|
$mail = $_SESSION['mail'];
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
function addVoiture(){
|
|||
|
//global $db;
|
|||
|
$requete = "INSERT INTO "public"."voiture" ("matricule","marque","modele","nbplaces","anneefab","mail") VALUES ('"global $matricule"','"global $marque"','"global $modele"','"global $nbplaces"','"global $anneefab"','"$_SESSION['mail']"');";
|
|||
|
echo "requete =".$requete;
|
|||
|
//pg_query($db, $requete);
|
|||
|
}
|
|||
|
?>
|