I don’t understand why any of my form doesn’t work if I appeal them in an include form
for example:
public function afficher_tache_veterinaire($id,$id_secteur){
$emp=$this -> tab_employe();
$e=$emp[$id];
echo 'Bonjour employé numéro '.$id.": ".$e["fonction"]." ".$e["prenom"]." ".$e["nom"];
echo ' vous etes affecté aux secteurs ';
foreach($e["secteur"] as $sec){
echo $sec["nom_secteur"].", ";
}
echo 'Que voulez-vous faire ?';
?>
<!-- Bouton pour créer un médicament -->
<form action="" method="post">
<button type="submit" name="c_medicament">Créer un médicament</button>
</form>
<?php
if (isset($_POST['c_medicament'])) {
include 'c_medicament.php';
}
}
c_medicament.php :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Inscription</title>
</head>
<body>
<h1> création medicament</h1>
<form method="post">
<input type="text" id="nom" name="nom" placeholder="nom" /><br/><br/>
<button type="submit" name="bouton" id="bouton">VALIDER </button>
</form>
<?php
if(isset($_POST["bouton"])){
if (isset($_POST['nom'])) {
$nom=$_POST['nom'];
include_once "DB.php";
global $bdd;
$medicament = new medicament();
$medicament -> creer_medicament($nom);
}else{
?> <script> window.alert("merci de rentrer toutes les valeurs ")</script> <?php
}
}
?>
and creer_medicament($nom) is a basic INSERT INTO sql function.
my problem is that the function c_medicament work by itself but not when I include it in an other form,
it instantly disapear when i click on it.
I’m pretty confident that it’s something about session or a thing like that but I dont know what to do