When i click on the add menu link in order to fill a post from a form , the add button do not work. But when i refresh the page without clicking on the add menu link the add button works well.
here is the menu links :
<ul class="sidebar-nav">
<li>
<a class="collapsed" href="#sidebar-ui" data-toggle="collapse" data-parent="#sidebar">
<span class="icon">
<i class="glyphicon glyphicon-align-right"></i>
</span>
MENU
</a>
<ul id="sidebar-ui" class="collapse">
<li><a href="form_ajout.php" target="content-wrap" hover="red">Ajouter</a></li>
<li><a href="Lister.php" target="content-wrap">Afficher</a></li>
<li><a href="modifier_BD.php" target="content-wrap">Modifier</a></li>
<li><a href="supprimer.php" target="content-wrap">Supprimer</a></li>
<li><a href="consulter.php" target="content-wrap">Consulter</a></li>
<li><a href="rechercher.php" target="content-wrap">Rechercher</a></li>
<li><a href="galerie.php" target="content-wrap">Galeries</a></li>
<li><a href="afficher.php" target="content-wrap">Excel file</a></li>
</ul>
</li>
and here is the form :
<form id="validation-form" class="form-horizontal form-label-left" method="post" data-parsley-priority-enabled="false" novalidate="" action="ajout_BD.php">
<fieldset>
<div class="form-group">
<label class="control-label col-sm-3" for="basic">NOM :</label>
<div class="col-sm-9">
<input type="text" id="basic" name="Nom" class="form-control " data-parsley-trigger="change" required="required" data-parsley-id="1769" placeholder="Entrez votre Nom ">
<ul class="parsley-errors-list" id="parsley-id-1769">
<li class="parsley-required">Champ obligatoire.</li> </ul>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3" for="basic-change">
Prénom :
</label>
<div class="col-sm-9">
<input type="text" id="basic-change" name="Prenom" class="form-control " data-parsley-trigger="change" required="required" data-parsley-id="9306" placeholder="Entrez votre Prénom ">
<ul class="parsley-errors-list filled" id="parsley-id-9306">
<li class="parsley-required">Champ obligatoire.</li>
</ul>
</div>
</div>
</fieldset>
<fieldset>
<div class="form-group">
<label class="control-label col-sm-3" for="email">
E-mail
</label>
<div class="col-sm-9">
<input type="email" id="email" name="Email" class="form-control " data-parsley-trigger="change" data-parsley-validation-threshold="1" required="required" data-parsley-id="2751" placeholder="Entrer votre E-mail">
<ul class="parsley-errors-list filled" id="parsley-id-7040">
<li class="parsley-required">Champ obligatoire.</li>
<li class="parsley-type">Cette valeur doit correspondre à un E-mail valide.</li>
</ul>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3" for="number">
Téléphone :
</label>
<div class="col-sm-9">
<input type="text" id="number" name="Telephone" class="form-control" data-parsley-type="number" required="required" data-parsley-id="2157" placeholder="Entrez votre Téléphone"><ul class="parsley-errors-list" id="parsley-id-2157"></ul>
<ul class="parsley-errors-list filled" id="parsley-id-1434">
<li class="parsley-required">Champ obligatoire.</li>
</ul>
</div>
</div>
</div>
</fieldset>
<div class="form-actions">
<input type="submit" class="btn btn-danger btn-rounded pull-right" name="valider" value="Ajouter"/>
<button type="button" class="btn btn-default btn-rounded" name="Annuler" ><a href="NewMenu.php">Annuler</a></button>
</div>
PS: The validation form and the menu are in the same page. It is in French so the add button value is Ajouter . The same value for the add link menu.
here is the page code that fills the information posted from the form_ajout.php page into the database , this code is separated on an other page which is : ajout_BD.php .
<?php
//connexion à SQL et sélection de la base
include("connexion.php");
$_Nom=$_POST['Nom'];
$_Prenom = $_POST['Prenom'];
$_Email = $_POST['Email'];
$_Tel = $_POST['Telephone'];
$Date = date("Y-m-d");
if(($_Nom == "")||($_Email==""))
{
echo "vous devez remplir les champs nom et email ! <br>";
}
else
{
$sql = "INSERT INTO etudiants (Nom, Prenom, Email, Telephone, Date) VALUES ('$_Nom','$_Prenom','$_Email','$_Tel','$Date')" ;
mysqli_query($db,$sql);
mysqli_close($db);
if($sql){
echo "<h2>Etudiant ajouté avec succès !</h2>";
}
} ?>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.