J'ai un problème sur mon site PHP fait sur notepad++
Dans le back office de mon site, lorsque je remplis le formulaire pour ajouter des données dans ma BDD(mysql), si je raffraichi la page, les données que je viens d'intégrer s'ajoutent à nouveau et ce à chaque fois que j'appuie sur F5.
Voici le code PHP de ma page
if(isset($_POST['enregistrement']))
{
if(empty($msg))
{
execute_requete("REPLACE INTO avis(id_avis, id_membre, id_salle, commentaire, note, date_avis) VALUES ( '$_POST[id_avis]', '$_POST[id_membre]', '$_POST[id_salle]', '$_POST[commentaire]', '$_POST[note]','$_POST[date_avis]')");
$_GET['action'] = "affichage";
}
}
//::::::::::::::::::::::::::::::::::::::::::::::::::::://
//:::::::::::::: Suppression article ::::::::::::::::://
if(isset($_GET['action']) && $_GET['action'] == "suppression" )
{
// $msg .= "test suppression";
$resultat = information_sur_un_avis_backoffice($_GET['id']);
$article_a_supprimer = $resultat->fetch_assoc();
execute_requete("DELETE FROM avis WHERE id_avis=$_GET[id]");
$_GET['action'] = "affichage";
}
require_once("../inc/header_inc.php");
?>
<div id="conteneur">
<?php
require_once("../inc/nav_inc.php");
echo $msg;
echo "<div id='menu_gestion'>";
include("../inc/menu_gestion_inc.php");
echo "<h1>Gestion avis</h1>";
echo "<a href='?action=ajout'>Ajouter un avis</a><br />";
echo "<a href='?action=affichage'>Afficher les avis</a><br/>";
//:::::::::::::::::::::::::::::::::::::::::::::::::::://
//:::::::::::::: Affichage boutique ::::::::::::::::://
if(isset($_GET['action']) && $_GET['action'] == "affichage" )
{
echo "<h1>Affichage des Avis</h1>";
$resultat = execute_requete("SELECT * FROM avis");
echo "Nombre de membre: " .$resultat->num_rows;
$nbcol = $resultat->field_count;
echo "<table border=5><tr>";
for($i=0; $i<$nbcol; $i++)
{
$colonne = $resultat->fetch_field();
echo "<th>". $colonne->name ."</th>";
}
echo "<th>Modification</th>";
echo "<th>Suppression</th>";
echo "</tr>";
while($ligne = $resultat->fetch_assoc())
{
echo "<tr>";
foreach($ligne as $indice => $valeur)
{
echo "<td>" . $valeur . "</td>";
}
echo "<td><a href='?action=modification&id=" . $ligne['id_avis'] . "'>---</a></td>";
echo "<td><a href='?action=suppression&id=" . $ligne['id_avis'] ."' onClick=\"return(confirm('En etes vous certain?'));\">x</a></td>";
echo "</tr>";
}
echo "</table>";
}
//:::::::::::::::::::::::::::::::::::::::::::::::::::://
//::::::::::::: Affichage / Modification formulaire :::::::::::::::://
if(isset($_GET['action']) && ($_GET['action'] == "ajout" || $_GET['action'] == "modification"))
{
if(isset($_GET['id']))
{
echo "test modification";
$resultat = information_sur_un_avis_backoffice($_GET['id']);
$article_actuel = $resultat -> fetch_assoc();
}
?>