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
|
<?php
session_start();
//-----------------------------
// connection à la DB
include('./connect-bd.php');
//-----------------------------
if (isset($_POST["modif"]))
{
header('Location:FormInscriptionAjax.php');// mettre le nom du fichier de ton formulaire "
exit;
}
if (isset($_POST["conf"]))
{
// enregistrement des données de session en bdd
if (isset($_POST["conf"],$_SESSION['post_form']))
{
try
{
$pdo_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
$pdo_options[PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET NAMES utf8';
$pdo_options[PDO::ATTR_EMULATE_PREPARES] = false;
$bdd = new PDO('mysql:host=localhost;dbname=clients', 'root', '', $pdo_options);
// Insertion du message à l'aide d'une requête préparée
$req = $bdd->prepare('INSERT INTO coordonnees (motdepasse, nom_categorie, nom_selection, nom, prenom, numtel,ville,SiteWeb,MaPage,infos,horaire,Ouverture,adresse,mail) VALUES(?, ?, ?,?, ?, ?,?, ?, ?,?,?,?,?,?)');
$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 PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Confirmation</title>
</head>
<body>
<form>
<strong>Veuillez contrôler vos coordonnées et cliquer sur <em>confirmer</em> si celles-ci sont correctes, dans le cas contraire cliquer sur <em>modifier</em></strong>
<p>Votre mot de passe : <?php echo isset($_SESSION['post_form']['motdepasse'])? $_SESSION['post_form']['motdepasse'] : '' ?></p>
<p>Votre catégorie : <?php echo isset($_SESSION['post_form']['nom_categorie'])? $_SESSION['post_form']['nom_categorie'] : '' ?></p>
<p>Votre selection : <?php echo isset($_SESSION['post_form']['nom_selection'])? $_SESSION['post_form']['nom_selection'] : '' ?></p>
</p>
<p>Votre nom : <?php echo isset($_SESSION['post_form']['nom'])? $_SESSION['post_form']['nom'] : '' ?></p>
<p>Votre prenom : <?php echo isset($_SESSION['post_form']['prenom'])? $_SESSION['post_form']['prenom'] : '' ?></p>
<p>Votre téléphone : <?php echo isset($_SESSION['post_form']['numtel'])? $_SESSION['post_form']['numtel'] : '' ?></p>
<form action = '#' method = "post" >
<input type = "submit" value = "modifier" name= "modif" />
<input type = "submit" value = "confirmer" name= "conf" />
</form>
<a href="Accueil.html"></a>
<?php
print_r($_SESSION)
?>
</body>
</html> |
Partager