voici mapremiere page php, je veux que la seconde affiche juste les la requete mysql des cases à cochées, impossible! j'en perd mes cheveux!
voici le code de la premiere page:
<style type="text/css">
<!--
body,td,th {
color: #CC3399;
}
body {
background-color: #000000;
}
-->
</style>
<?
$fp = fopen("compteur.txt","r+"); // 1.On ouvre le fichier en lecture/écriture
$nbvisites = fgets($fp,11); // 2.On récupère le nombre dans le fichier
$nbvisites++; // 3.On incrémente le nombre de visites(+1)
fseek($fp,0); // 4.On se place en début de fichier
fputs($fp,$nbvisites); // 5.On écrit dans le fichier le nouveau nb
fclose($fp); // 6.On ferme le fichier
echo '<div align="right"><font face="arial" size="2" color="blue"> <br /> '; // 7.On affiche le compteur à l'écran
print ("$nbvisites Utilisations") ;
echo '<div align="right"> <br />';
$date = date("d-m-Y");
$heure = date("H:i");
echo("Nous sommes le $date et il est $heure");
?>
<html>
<head>
<title>Affichage Information</title>
</head>
<center>
<p><img src="pharmacie_large.jpg" alt="Lumières" width="163" height="193"></p>
<p>
<body>
<?php
echo '<div align="left"> <br />';
echo "<br><table border=3 width=80%>";
echo "<tr bgcolor='#9999FF'><td>Pour ajouter ou supprimer un produit , utiliser ce formulaire </td></tr>";
echo "<form action='./index.php' method=get target=\"_self\">";
echo "<tr><td>nom :</td><td><input type=text name=nom size=40></td></tr>";
echo "<tr><td>prix :</td><td><input type=text name=prix size=40></td></tr>";
echo "<tr><td>poids :</td><td><input type=text name=poids size=40></td></tr>";
echo "<tr><td>commentaire :</td><td><input type=text name=commentaire size=45></td></tr>";
echo "<tr><td colspan=2 align=center width=100%><input type=submit name=action value=add>";
echo "<input type=submit name=action value=sup></td>";
echo "</form>";
echo "</table>";
?>
<br>
<hr align="left" width="1000" size="10" noshade color="#CC3399">
<?
if (isset($_GET['action']) )
{
$fnom = $_GET['nom'];
$fprix = $_GET['prix'];
$fpoids = $_GET['poids'];
$fcommentaire = $_GET['commentaire'];
$faction = $_GET['action'];
$c = mysql_connect("localhost","root","") or die ("connection impossible");
mysql_select_db("sam",$c) or die ("selection impossible");
//echo $faction;
if ($faction == 'add')
{
$sql = "insert into tikette ( nom, prix, poids, commentaire) values ( '$fnom', '$fprix', '$fpoids', '$fcommentaire' )";
}
if ($faction == 'sup')
{
$sql = "delete from `tikette` where `nom` ='$fnom'";
}
mysql_query($sql,$c);
mysql_close($c);
}
// connection bdd
$c = mysql_connect("localhost","root","") or die ("connection impossible");
mysql_select_db("sam",$c) or die ("selection impossible");
// initialisation
if(empty($debut)) $debut = '0'; // premiere page
// requete sql
$sql = "select * from tikette order by nom";
echo '<div align="left"> <br />';
echo "<table border=3 width=80%>";
echo "<tr bgcolor='#9999FF'><td>ETIQUETTES DISPONIBLES</td></tr>";
echo "<tr bgcolor='#9999FF'><td>NOM</td><td>PRIX</td><td>POIDS</td><td>COMMENTAIRE</td><td>PRINT <FORM method=\"POST\" action=\"traitement.php\"><input type=\"Submit\" value=\"OK\"></td></tr>"
;
// parcours et affichage des résultats
if($p = @mysql_query($sql,$c))
{
while($r = @mysql_fetch_array($p))
{
echo "<tr><td>$r[nom]<br></td>";
echo "<td>$r[prix]<br></td>";
echo "<td>$r[poids]<br></td>";
echo "<td>$r[commentaire]<br></td>";
echo "<td><input type=\"checkbox\" name=\"mon_champ[]\"value=$r[nom]>Print<br><br></td></tr>";
}
echo "</table>";
}
@mysql_close($c);
?>
</FORM></form>
</body>
</html>
comment faire traitement.php?????? svp help me