Après avoir régler mon problème de formulaire et que tout va comme je le veux, il faut que je rajoute un système de panier à tout ça mais je cherche et je ne sais pas par où commencer ni comment y proceder.
Je vais vous presenter mon code et ma base :
<?php
@$form1 = $_GET['type'];
$_GET['type'] = $form1;
@$form2 = $_GET['cartouche'];
$_GET['cartouche'] = $form2;
@$form3 = $_GET['Ref'];
$_GET['Ref'] = $form3;
$based = "localhost";
$admin = "root";
$password = "";
$bdd = "base";
$connect = mysql_connect($based,$admin,$password);
mysql_select_db($bdd, $connect) or die("Impossible de se connecter");
echo '<form id="menuselect1" action="'.$_SERVER['PHP_SELF'].'" method="get">
<div align="center">
<select name="type" onchange="document.forms[\'menuselect1\'].submit()"> ';
$base = "SELECT DISTINCT Types FROM tarif$";
$req = mysql_query($base) or die('Erreur SQL !'.$sql.''.mysql_error());
echo '<option selected="selected">'.$form1.'</option>';
while($data = mysql_fetch_array($req)){
echo '<option>'.$data['Types'].'</option>';
}
echo '</select>
<noscript><input type="submit" name="ok" value="ok" /></noscript>';
if ($form1 == "") {
die();
}
else {
echo '<select name="cartouche" onchange="document.forms[\'menuselect1\'].submit()"> ';
$base2 = "SELECT DISTINCT (Marques) FROM tarif$ WHERE Types = '$form1'";
$req2 = mysql_query($base2) or die('Erreur SQL !'.$sql.''.mysql_error());
echo '<option selected="selected">'.$form2.'</option>';
while($data2 = mysql_fetch_array($req2)){
echo '<option>'.$data2['Marques'].'</option>';
}
echo '</select>
<noscript><input type="submit" name="ok" value="ok" /></noscript>';
if ($form2 == "") {
die();
}
else{
echo '<select name="Ref" onchange="document.forms[\'menuselect1\'].submit()">';
mysql_select_db($bdd) or die("Impossible de se connecter");
$base3 = "SELECT DISTINCT (Ref) FROM tarif$ WHERE Marques = '$form2' AND Types = '$form1'";
$req3 = mysql_query($base3) or die('Erreur SQL !'.$sql.''.mysql_error());
echo '<option selected="selected">'.$form3.'</option>';
while($data3 = mysql_fetch_array($req3)){
echo '<option>'.$data3['Ref'].'</option>';
}
echo '</select>
</form>';
if ($form3 == "") {
die();
}
else {
echo '<table width="673" height="78" border="1">
<tr align="center" valign="middle">
<td width="100" height="40"><strong>Type de Produit </strong></td>
<td width="100" height="40"><strong>Marques du Fabriquant </strong></td>
<td width="100" height="40"><strong>Réfèrence du produit </strong></td>
<td width="100" height="40"><strong>Observation</strong></td>
<td width="100" height="40"><strong>Code OEM</strong></td>
<td width="100" height="40"><strong>Prix HT en € </strong></td>
<td width="100" height="40"><strong>Ajouter au panier </strong></td>
</tr>';
$base4 = "SELECT * FROM tarif$ WHERE Ref = '$form3' AND Marques = '$form2' AND Types = '$form1'";
$req4 = mysql_query($base4) or die('Erreur SQL !'.$sql.''.mysql_error());
while($data4 = mysql_fetch_array($req4)){
echo '<tr align="center" valign="middle">
<td width="100" height="40"><strong>'.$data4['Types'].'</strong></td>
<td width="100" height="40"><strong>'.$data4['Marques'].'</strong></td>
<td width="100" height="40"><strong>'.$data4['Ref'].'</strong></td>
<td width="100" height="40"><strong>'.$data4['Observations'].'</strong></td>
<td width="100" height="40"><strong>'.$data4['CODE OEM'].'</strong></td>
<td width="100" height="40"><strong>'.$data4['PRIX'].'</strong></td>
<td width="100" height="40"><form id="panier" name="panier" method="POST" action="">
<input type="submit" value="Ajouter"/>
</form></td>';
}
}
}
}
?>
Voila, et ma base incomplete peut etre telecharger sous forme de texte sur mon site : http://shishiza90.descis.info/base.txt.Pour vous faciliter la tache, il y a deux produit qui s'affiche pour : Matricielle => ADP => Printronix
cela peut permettre de tester le script et comment ça sera avec la base complete que je n'ai pas d'ailleur...
Merci pour vos réponses