Пример #1
0
<?php

include "header.html";
include "fonctions.php";
if (isset($_POST["validation"]) && $_POST["validation"] == "enregistrer") {
    $requete = ajoutHotel($_POST["nom_hotel"], $_POST["adresse_hotel"], $_POST["cp_hotel"], $_POST["classement"], $bdd);
    if (isset($_POST["retour"])) {
        $retour = modifBbsitting($_POST["idbbsitting"], "id_hotel", $requete["id_insert"], $bdd);
        // print_r($retour);die;
        header('Location:' . $_POST["retour"] . '.php?source=ajouthotel&id=' . $requete["idbbsitting"]);
    } else {
        echo "ok";
    }
    // echo "<br />reponse: ";print_r($requete);
} else {
    $reponse = $bdd->query('select * from classement');
    ?>
	<h1>Ajouter un hôtel</h1>

      </header>

	
<form method="post" action="#" class="form-horizontal">
<?php 
    if (isset($_GET["retour"]) && isset($_GET["id"])) {
        ?>
	<input type="hidden" name="retour" value=" <?php 
        echo $_GET["retour"];
        ?>
">
	<input type="hidden" name="idbbsitting" value=" <?php 
Пример #2
0
<?php

include "header.html";
include "fonctions.php";
if (isset($_POST["validation"]) && $_POST["validation"] == "enregistrer") {
    if (!isset($_POST["francais"]) && (isset($_POST["id_langue"]) && $_POST["id_langue"] != 1)) {
        $_POST["francais"] = 0;
    } else {
        $_POST["francais"] = 1;
    }
    $requete = ajoutFamille($_POST["nom_famille"], $_POST["nombre_enfants"], $_POST["idlangue1"], $_POST["pays"], $_POST["francais"], $bdd);
    if (isset($_POST["retour"])) {
        modifBbsitting($_POST["idbbsitting"], "id_famille", $requete["id_insert"], $bdd);
        header('Location:' . $_POST["retour"] . '.php?source=ajoutfamille&id=' . $requete["idbbsitting"]);
    } else {
        header('Location:fichebbsitting.php?id=' . $requete["id_insert"]);
    }
    // echo "<br />reponse: ";print_r($requete);
}
if (isset($_POST["validation"]) && $_POST["validation"] == "modification") {
    // print_r($_POST["francais"]); echo "  ";print_r($_POST["id_langue"]); die;
    if (!isset($_POST["francais"]) && (isset($_POST["id_langue"]) && $_POST["id_langue"] != 1)) {
        $_POST["francais"] = 0;
    } else {
        $_POST["francais"] = 1;
    }
    $requete = modifFamille($_POST["idbbsitting"], $_POST["idfamille"], $_POST["nom_famille"], $_POST["nombre_enfants"], $_POST["idlangue1"], $_POST["pays"], $_POST["francais"], $bdd);
    header('Location:fichebbsitting.php?id=' . $requete["id_modif"]);
} else {
    $pays = pays();
    // print_r($pays);die;