Bonjour a toutes et a tous. J'ai un souci avec mon code :
<?php
session_start();
//AJOUTER
if($_POST["envoi"]=="AJOUTER" && $_POST["code"]!=" " && $_POST["article"]!=" " && $_POST["prix"]!=" ")
{
$code=$_POST["code"];
$article= $_POST["article"];
$prix= $_POST["prix"];
$_SESSION['code'][]=$code;
$_SESSION['article'][]=$article;
$_SESSION['prix'][]=$prix;
}
//VERIFIER
if($_POST["envoi"]=="VERIFIER")
{
echo "<table border=\"1\" >";
echo "<tr><td colspan=\"3\"><b>Recapitulatif de votre commande</b></td>";
echo "<tr><th> code </th><th> article </th><th> prix </th>";
for($i=0; $i<count($_SESSION["code"]); $i++)
{
echo "<tr> <td>{$_SESSION['code'][$i]}</td>
<td> {$_SESSION['article'][$i]}</td>
<td> {$_SESSION['prix'][$i]}</td>";
$prixtotal+=$_SESSION['prix'][$i];
}
echo "<tr> <td colspan=2> PRIX TOTAL </td> <td>" . sprintf("%01.2f", $prixtotal)."</td>";
echo "</table>";
}
//ENREGISTRER
if($_POST["envoi"]=="ENREGISTRER")
{
$idfile=fopen("commande.txt", w);
for($i=0; $i<count($_SESSION["code"]);$i++)
{
fwrite($idfile, $_SESSION["code"][$i]." ; ".$_SESSION["article"][$i]." ; ".$_SESSION["prix"][$i]."; \n");
}
fclose($idfile);
}
$_POST["envoi"]="";
?>
<html>
<head>
<title> Gestion de Panier </title>
</head>
<body>
<form action="<?= $_SERVER['PHP SELF'] ?>" method="post" enctype="application/x-www-form-urlencoded">
<fieldset>
<legend><b>Saisie d'articles</b></legend>
<table>
<tbody>
<tr>
<th>code : </th>
<td> <input type="text" name="code" /></td>
</tr>
<tr>
<th>article : </th>
<td> <input type="text" name="article" /></td>
</tr>
<tr>
<th>prix : </th>
<td> <input type="text" name="prix" /></td>
</tr>
<tr>
<td colspan="3">
<input type="submit" name="envoi" value="AJOUTER" />
<input type="submit" name="envoi" value="VERIFIER" />
<input type="submit" name="envoi" value="ENREGISTRER" />
</td>
</tr>
</tbody>
</table>
</fieldset>
</form>
</body>
</html>
En fait il me met les erreurs suivantes au depart mais affiche quand meme mon tableau:
Notice: Undefined index: envoi in
c:\program files\easyphp1-8\www\essai panier php\commande.php on line
5Notice: Undefined index: envoi in
c:\program files\easyphp1-8\www\essai panier php\commande.php on line
18Notice: Undefined index: envoi in
c:\program files\easyphp1-8\www\essai panier php\commande.php on line
37
et quand je veut effectuer une commande en ajoutant un produit quelqconque voila ce qu'il me met:
Forbidden
You don't have permission to access /Essai Panier PHP/<br
/><b>Notice</b>: Undefined index: PHP SELF in
<b>c:\program files\easyphp1-8\www\essai panier
php\commande.php</b> on line <b>55</b><br />
on this server.
Si vous pouviez m'indiquer l'erreur ... merci d'avance...