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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
| <?php session_start();
//-----------------------------
// connection à la DB
include('./connect-bd.php');
//-----------------------------
// Modification
if (isset($_POST["modif"]))
{
header('Location: FormInscriptionAjax.php');// mettre le nom du fichier de ton formulaire "
exit;
}
//-----------------------------
// Confirmation
if (isset($_POST['conf'], $_SESSION['post_form']))
{
// enregistrement des données de session en bdd
try {
// Insertion du message à l'aide d'une requête préparée
$sql = 'INSERT INTO coordonnees (motdepasse, nom_categorie, nom_selection, nom, prenom, numtel,ville,SiteWeb,MaPage,infos,horaire,Ouverture,adresse,mail) VALUES(?, ?, ?,?, ?, ?,?, ?, ?,?,?,?,?,?)';
$req = $bdd->prepare($sql);
$req->execute(array($_SESSION['post_form']['motdepasse'], $_SESSION['post_form']['nom_categorie'], $_SESSION['post_form']['nom_selection'], $_SESSION['post_form']['nom'], $_SESSION['post_form']['prenom'],$_SESSION['post_form']['nom_province'], $_SESSION['post_form']['numtel'], $_SESSION['post_form']['ville'],$_SESSION['post_form']['SiteWeb'], $_SESSION['post_form']['MaPage'],$_SESSION['post_form']['infos'],$_SESSION['post_form']['horaire'],$_SESSION['post_form']['Ouverture'],$_SESSION['post_form']['adresse'],$_SESSION['post_form']['mail']));
unset($_SESSION['post_form']);
//redirection vers la page d'index
header('Location: Accueil.html');
exit;
}
catch(Exception $e)
{
die('Erreur : '.$e->getMessage());
}
}
//-----------------------------
//... (Ne pas oublier le "exit;" après un header Location)
?>
<!DOCTYPE html>
<html dir="ltr" lang="fr">
<head>
<meta charset="utf-8" />
<title>Confirmation</title>
<style>
#confirmationBox { width:48em; margin:auto; border:1px solid black; padding:1em; }
#confirmationBox label { display:inline-block; min-width: 150px; }
</style>
</head>
<body>
<div id="confirmationBox">
<h4>Veuillez contrôler vos coordonnées</h4>
<strong>Cliquez sur <em>confirmer</em> si celles-ci sont correctes, sinon cliquez sur <em>modifier</em></strong>
<p>
<label>Votre catégorie : </label>
<?php echo isset($_SESSION['post_form']['nom_categorie'])? $_SESSION['post_form']['nom_categorie'] : '' ?>
</p>
<p>
<label>Votre sélection : </label>
<?php echo isset($_SESSION['post_form']['nom_selection'])? $_SESSION['post_form']['nom_selection'] : '' ?>
</p>
<p>
<label>Votre mot de passe : </label>
<?php echo isset($_SESSION['post_form']['motdepasse'])? $_SESSION['post_form']['motdepasse'] : '' ?>
</p>
<p>
<label>Votre nom : </label>
<?php echo isset($_SESSION['post_form']['nom'])? $_SESSION['post_form']['nom'] : '' ?>
</p>
<p>
<label>Votre prenom : </label>
<?php echo isset($_SESSION['post_form']['prenom'])? $_SESSION['post_form']['prenom'] : '' ?>
</p>
<p>
<label>Votre téléphone : </label>
<?php echo isset($_SESSION['post_form']['numtel'])? $_SESSION['post_form']['numtel'] : '' ?>
</p>
<p>
<form action = '#' method = "post" >
<input type = "submit" value = "modifier" name= "modif" />
<input type = "submit" value = "confirmer" name= "conf" />
</form>
</p>
<p>
<a href="Accueil.html">Accueil</a>
</p>
</div>
<?php
//print_r($_SESSION)
?>
</body>
</html> |
Partager