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
|
<?php
include("connect.php");
include("fonctionsphp.php");
<?php
$name = isset($_POST['name']) ? $_POST['name'] : "";
$firstname = isset($_POST['firstname']) ? $_POST['firstname'] : "";
$phone = '';
$nation = isset($_POST['nation']) ? $_POST['nation'] : "";
$mail = '';
$password = '';
$saisie = '';
echo $bdd; // à supprimer
if (isset($_POST['enregistrer'])) {
if ((!empty($_POST['name'])) && (!empty($_POST['firstname'])) && (!empty($_POST['nation']))){
//on met la 1ere lettre du nom en majuscule
$name = ucfirst($_POST['name']);
$firstname = ucfirst($_POST['firstname']);
$nation = ucfirst($_POST['nation']);
//enregistre le membre ** fonctionnait avec php 5.4
//$requete = "INSERT INTO membres (id, nom, prenom, phone, nationalite, mail, password)
//VALUES('','$name','$firstname', '$phone', '$nation', '$mail', '$password')";
//$resultat = $mysqli->query($requete) or die ('Erreur '.$requete.' '.$mysqli->error());
//requête avec 5.6 qui ne fonctionne pas issue d'un tuto
$req = $bdd->prepare('INSERT INTO membres (nom, prenom, nationalite)
VALUES(:name, :firstname, :phone, :nationalite)');
$req->execute(array(
'nom' => $name,
'prenom' => $firstname,
'nationalite' => $nation,));
$saisie = "Enregistrement de $name $firstname $nation effectué";
$_POST['name'] = '';
$_POST['firstname'] = '';
$_POST['nation'] = '';
}
else {
$saisie = "Pas d'enregistrement effectué, les cases ne sont pas renseignées !";
}
}
?>
<div style="text-align:center">
<p> pour obtenir ß = alt +225</p>
<FORM name="research" ACTION = "index.php?page=comite" METHOD="POST">
Nom : <input type="text" name="name" value="" /><br /><br />
Prenom : <input type="text" name="firstname" value="" /><br /><br />
Nationalité : <input type="text" name="nation" value="" /><br /><br />
<input style="cursor:pointer;" type="submit" name="enregistrer" value="Enregistrer" />
</FORM>
<?php echo $saisie;?>
</div> |
Partager