Avec ce lien :
Code : Tout sélectionner
<a href="agtentDel.php?id=1">suppr</a>
Code : Tout sélectionner
<a href="agtentDel.php?id=1">suppr</a>
<?php
include_once("../connexion.php");
include_once("../fonction.inc.php");
if (isset($_POST['nom']))
$nom = $_POST['nom'];
else
$nom = "";
if (isset($_POST['nat']))
$nation = $_POST['nat'];
else
$nation = "";
agententAdd($nom, $nation);
header("Location: rech_agtent.php");
?>
Code : Tout sélectionner
<form name="" action="agentAjout.php" method="post">
nom : <input type="Text" name="nom" value=""><br>
nationalité : <input type="Text" name="nat" value=""><br>
<input type="Submit" value="go">
</form><?php
//include_once("../connexion.php");
include_once("fonction.inc.php");
// on se connecte à MySQL
$db = mysql_connect('localhost', 'root', '');
// on sélectionne la base
mysql_select_db('test',$db);
if (isset($_POST['nom']))
$nom = $_POST['nom'];
else
$nom = "";
if (isset($_POST['nat']))
$nation = $_POST['nat'];
else
$nation = "";
agententAdd($nom, $nation);
header("Location: consult_agtent.php");
?>
Page fonction.inc.php :
<?php
function agententAdd($nom,$nation) {
mysql_query("insert into agent_dentretien(num_pers, nom_pers, nationalite) values('', '$nom', '$nation')");
}
?>