Redirection
Bonjour, j'ai un dernier soucis après je dois rendre mon projet. Une fois qu'on choisit les jours de garderie, je voudrais quand cliquant sur enregistrer ça redirige vers index2.html, comment puis - je faire ?
Voici les codes :
reservation_garderie.html :
reservation_garderie.php :
Merci d'avance
Voici les codes :
reservation_garderie.html :
<head>
<meta charset="utf-8" />
<h1> Reservation garderie </h1>
</head>
<body>
<form method="POST" action="reservation_garderie.php">
<form>
<table>
<tr>
<th> </th>
<th> Lundi </th>
<th> Mardi </th>
<th> Mercredi </th>
<th> Jeudi </th>
<th> Vendredi </th>
</tr>
<tr>
<th> Matin </th>
<th> <INPUT type="checkbox" name="lundi_matin" value="1"> </th>
<th> <INPUT type="checkbox" name="mardi_matin" value="1"> </th>
<th> <INPUT type="checkbox" name="mercredi_matin" value="1"> </th>
<th> <INPUT type="checkbox" name="jeudi_matin" value="1"> </th>
<th> <INPUT type="checkbox" name="vendredi_matin" value="1"> </th>
</tr>
<tr>
<th> Soir </th>
<th> <INPUT type="checkbox" name="lundi_soir" value="1"> </th>
<th> <INPUT type="checkbox" name="mardi_soir" value="1"> </th>
<th> <INPUT type="checkbox" name="mercredi_soir" value="1"> </th>
<th> <INPUT type="checkbox" name="jeudi_soir" value="1"> </th>
<th> <INPUT type="checkbox" name="vendredi_soir" value="1"> </th>
</tr>
</table>
</body>
<br></br>
<INPUT TYPE="submit" NAME="submit" VALUE=" Envoyer ">
</form>
reservation_garderie.php :
<?php
error_reporting(E_ALL);
require_once "cnxBDD.php";
$nom = isset($_POST['nom']) ? htmlentities(trim($_POST['nom'])) : '';
$prenom = isset($_POST['prenom']) ? htmlentities(trim($_POST['prenom'])) : '';
$id_ecole = isset($_POST['ecole']) ? htmlentities(trim($_POST['ecole'])) : '';
if(isset($_POST['submit'])) {
try {
$a_datas = array(":nom"=>$nom,":prenom"=>$prenom,":id_ecole"=>$id_ecole);
$req = "INSERT INTO inscription_enfant (nom, prenom, id_ecole)
VALUES(:nom, :prenom, :id_ecole)";
$stmt = $bdd->prepare($req);
$stmt->execute($a_datas);
}catch (Exception $e){
echo "<br>Erreur : " . $e->getMessage();
echo "<br> <b>Requete :<b><br> ".$req;
echo "<br> params :<br><pre>";
print_r($a_datas);
echo "</pre>";
exit();
}
}
$lundi_matin = isset($_POST['lundi_matin']) ? 1 : 0;
$mardi_matin = isset($_POST['mardi_matin']) ? 1 : 0;
$mercredi_matin = isset($_POST['mercredi_matin']) ? 1 : 0;
$jeudi_matin = isset($_POST['jeudi_matin']) ? 1 : 0;
$vendredi_matin = isset($_POST['vendredi_matin'])? 1 : 0;
$lundi_soir = isset($_POST['lundi_soir']) ? 1 : 0;
$mardi_soir = isset($_POST['mardi_soir']) ? 1 : 0;
$mercredi_soir = isset($_POST['mercredi_soir']) ? 1 : 0;
$jeudi_soir = isset($_POST['jeudi_soir']) ? 1 : 0;
$vendredi_soir = isset($_POST['vendredi_soir']) ? 1 : 0;
try{
$sql = "INSERT INTO garderie (lundi_matin, lundi_soir, mardi_matin, mardi_soir, mercredi_matin, mercredi_soir, jeudi_matin, jeudi_soir, vendredi_matin, vendredi_soir)
VALUES (:lundi_matin, :lundi_soir, :mardi_matin, :mardi_soir, :mercredi_matin, :mercredi_soir, :jeudi_matin, :jeudi_soir, :vendredi_matin, :vendredi_soir)";
$a_data = array(":lundi_matin"=> $lundi_matin
,":lundi_soir"=> $lundi_soir
,":mardi_matin"=> $mardi_matin
, ":mardi_soir" => $mardi_soir
, ":mercredi_matin" => $mercredi_matin
, ":mercredi_soir" => $mercredi_soir
, ":jeudi_matin" => $jeudi_matin
, ":jeudi_soir" => $jeudi_soir
, ":vendredi_matin" => $vendredi_matin
, ":vendredi_soir" => $vendredi_soir);
$stmt = $bdd->prepare($sql);
$stmt->execute($a_data);
} catch (Exception $e){
echo 'Erreur : ' . $e->getMessage();
echo "<br> Dans la requête :".$sql;
echo "<br> Variables :<br><pre>";
print_r($a_data);
echo '$a_data';
echo "</pre>";
exit();
}
?>
<html>
<head>
</head>
<body>
<form action = "index2.html" href ="index2.html"
<input type="submit" name="submit" value="Envoyer">
</form>
</body>
Merci d'avance