40 lines
1.3 KiB
PHP
40 lines
1.3 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']))
|
|||
|
{
|
|||
|
changeVoiture();
|
|||
|
}
|
|||
|
|
|||
|
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 changeVoiture(){
|
|||
|
//global $db;
|
|||
|
|
|||
|
$requete = "UPDATE 'public'.'voiture' SET ('matricule','marque','modele','nbplaces','anneefab') = ('"$_POST['matricule']"','"$_POST['marque']"','"$_POST['modele']"','"$_POST['nbplace']"','"$_POST['anneefab']"') WHERE mail = 'mail';";
|
|||
|
//$requete = "UPDATE 'public'.'voiture' SET ('matricule','marque','modele','nbplaces','anneefab') = ('"$matricule"','"$marque"','"$modele"','"$nbplaces"','"$anneefab"') WHERE mail = '"$_SESSION['mail']"';";
|
|||
|
echo "requete =".$requete;
|
|||
|
//pg_query($db, $requete);
|
|||
|
}
|
|||
|
?>
|