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 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
| <?php
try {
$bdd = new PDO("mysql:host=localhost;dbname=proj_courrier_gestion;charset=UTF-8", "root", "");
} catch (Exception $e) {
die("Erreur de syntaxe !!" .$e->getMessage());
}
if (isset($_POST['yes'])) {
$nom_expedit = $_POST['nom_expedit'];
$nom_desti = $_POST['PSEUDO_USER'];
$email = $_POST['EMAIL'];
$message = $_POST['text'];
if ($_POST['nom_expedit'] AND ($_POST['PSEUDO_USER'])) {
try {
$kfe = $bdd->prepare("INSERT INTO imputation VALUES('', ?, ?, ?, ?,NOW())");
$kfe->execute(array($nom_expedit,$nom_desti,$email,$message));
echo "ok";
} catch (Exception $e) {
die("OUPS !!" .$e->getMessage());
}
}else {
echo "Pas d'insertion";
}
$kfe->closecursor();
}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Imputation</title>
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="bootstrap-3.3.6-dist/bootstrap-3.3.6-dist/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="icon" type="image/png" href="images1.png" />
<script language="JavaScript">
<!--
//permet de faire défiler le titre dans l'en tete de ma page
var txt=" Imputation - ";
var espera=200;
var refresco=null;
function rotulo_title() {
document.title=txt;
txt=txt.substring(1,txt.length)+txt.charAt(0);
refresco=setTimeout("rotulo_title()",espera);}
rotulo_title();
// -->
</script>
</head>
<body>
<h1 class="text-center"></h1>
<nav class="navbar navbar-inverse" role="navigation">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<a class="navbar-brand" href="#">Title</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
</ul>
</div><!-- /.navbar-collapse -->
</div>
</nav>
<form action="" method="POST" role="form" class="form-inline">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title" align="center"><b>Imputaion </b></h3>
</div>
<div class="panel-body">
<label for="input-id" class="col-sm-2"><b>Nom Expédideur: </b></label><input type="text" name="nom_expedit" id="input"
class="form-control" value="" required="" placeholder="Nom Expéditeur"><br /><br />
<label for="input-id" class="col-sm-2">Nom Destinataire:</label>
<?php
//cette requete ma permise de recupérer les informations depuis ma BDD pour la mettre dans mon formulaire
$rek1 = $bdd->prepare("SELECT * FROM user");
$rek1->execute();
echo "
<select name='PSEUDO_USER' id='input' class='form-control'>";
while ($result= $rek1->fetch()) {
echo "<option value='1'>$result[10]</option>";
}
echo "</select> <br /><br />";
$rek1->closecursor();
?>
<label for="input-id" class="col-sm-2"><b>Email Destinataire: </b></label>
<?php
$rek = $bdd->prepare("SELECT * FROM user");
$rek->execute();
echo "<select name='EMAIL' id='inputEmail_desti' class='form-control' >";
while ($result= $rek->fetch()) {
echo "
<option value='2'>$result[8]</option>
";
}
echo "</select> <br /><br />";
$rek->closecursor();
?>
<label for="input-id" class="col-sm-2"><b>Text: </b></label><textarea name="text" id="input" class="form-control" rows="3" required="" placeholder="Inscriver du message ici"></textarea><br /><br />
<div class="caf">
<button type="submit" class="btn btn-primary" name="yes">Envoyer</button>
</div>
<div class="cafe">
<button type="button" class="btn btn-danger" name="no"><b>Annuler</b></button>
</div>
</div>
</div>
</form>
<!-- jQuery -->
<script src="//code.jquery.com/jquery.js"></script>
<!-- Bootstrap JavaScript -->
<script src="bootstrap-3.3.6-dist/bootstrap-3.3.6-dist/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="Hello World"></script>
<nav class="navbar navbar-inverse navbar-fixed-bottom" role="navigation">
<div class="container" align="center">
<h3><span class="pieds">copyright@ by Cafeine 2016 Tous droits réservés</span></h3>
</div>
</nav>
</body>
</html> |
Partager