|
|
|
|
Squall, le mercredi 5 décembre 2007 à 19:21:28
<?php
include "../connexion.php";
?>
<body background="../Images/back.jpg" text="white">
<center>
<h2> Ajouter une imprimante </h2>
<form name="form" action="test.php" method="post" onsubmit="return verifChamps()">
<table>
<tr>
<td align="right">Veuillez entrer la référence de l'imprimante :</td>
<td><input type="text" name="code_imprimante" id="code_imprimante"></td>
</tr>
<tr>
<td align="right">Veuillez entrer la désignation de l'imprimante :</td>
<td><textarea type="text" name="designation_imprimante" id="designation_imprimante" rows="5" cols="15"></textarea></td>
</tr>
<tr>
<td align="right">Veuillez sélectionner le type d'imprimante :</td>
<td>
<select name="LibelType" id="LibelType">
<option></option>
<?php
$req= mysql_query('Select LibelType from Type order by LibelType')or die(mysql_error());
while ($ligne=mysql_fetch_array($req))
{
?>
<option><?php echo ''.$ligne['LibelType'].'';?> </option>
<?php
} ?>
</td>
</tr>
<tr>
<td align="right">Veuillez sélectionner la marque de l'imprimante :</td>
<td>
<select name="LibelMarque" id="LibelMarque">
<option></option>
<?php
$req2= mysql_query('Select LibelMarque from Marque order by LibelMarque')or die(mysql_error());
while ($ligne2=mysql_fetch_array($req2))
{
?>
<option><?php echo ''.$ligne2['LibelMarque'].'';?> </option>
<?php
} ?>
</td>
</tr>
</table>
<input type="submit" name="validation_ajout_imprimante">
</center>
</body>
?php
include "../connexion.php";
error_reporting(E_ALL ^ E_NOTICE);
?>
<body background="../Images/back.jpg" text="white">
<center>
<h2> Nouvelle imprimante : </h2>
<form action="test2.php" method="post">
<table>
<tr>
<td align="right">Référence de l'imprimante :</td>
<td><input type="text" name="code_imprimante" id="code_imprimante" value='<?php echo $_POST['code_imprimante']; ?>' readonly ></td>
</tr>
<tr>
<td align="right">désignation de l'imprimante :</td>
<td><input type="text" name="designation_imprimante" id="designation_imprimante" value='<?php echo $_POST['designation_imprimante']; ?>' readonly></td>
</tr>
<tr>
<td align="right">Type d'imprimante :</td>
<td>
<input type="text" name="LibelType" id="LibelType" value='<?php echo $_POST['LibelType']; ?>' readonly>
</td>
</tr>
<tr>
<td align="right">Marque de l'imprimante :</td>
<td>
<input type="text" name="LibelMarque" id="LibelMarque" value='<?php echo $_POST['LibelMarque']; ?>' readonly>
</td>
</tr>
</table>
<br>
<br>
<table border="">
<tr>
<th bgcolor="black"><font color="white">Référence</th>
<th bgcolor="black"><font color="white">Désignation</th>
<th bgcolor="black"><font color="white">Type</th>
<th bgcolor="black"><font color="white">Marque</th>
<th bgcolor="black"><font color="white">Prix</th>
<th bgcolor="black"><font color="white">Compatibilité</th>
</tr>
<?php
if ($connexion)
{
$req= mysql_query('Select CodeType from TYPE where LibelType="'.$_POST['LibelType'].'"')or die(mysql_error());
$req2= mysql_query('Select CodeMarque from Marque where LibelMarque="'.$_POST['LibelMarque'].'"')or die(mysql_error());
$y=mysql_fetch_assoc($req);
$z=mysql_fetch_assoc($req2);
$resultat=mysql_query('select * from cartouche_test where CodeMarque="'.$z['CodeMarque'].'" and CodeType="'.$y['CodeType'].'"') or die ("requète non executé");
$s=0;
while ($i=mysql_fetch_assoc($resultat))
{
$ref= $i['RefCart'];
$des= $i['DesCart'];
$LibelType= $_POST['LibelType'];
$LibelMarque= $i['LibelMarque'];
$prix= $i['PrixCart'];
$s=($s+1);
echo '<tr>';
echo '<td>';
//echo '<center>'.$ref;
echo '<center><input type="text" size="3" name=ref'.$s.' value='.$ref.' readonly ></center>';
echo '</td>';
echo '<td>';
//echo '<center>'.$des;
echo '<center><input type="text" size="3" name=des'.$s.' value='.$des.' readonly ></center>';
echo '</td>';
echo '<td>';
echo '<center>'.$_POST['LibelType'];
echo '</td>';
echo '<td>';
echo '<center>'.$_POST['LibelMarque'];
echo '</td>';
echo '<td>';
//echo '<center>'.$i['PrixCart'];
echo '<center><input type="text" size="3" name=prix'.$s.' value='.$prix.' readonly ></center>';
echo '</td>';
echo '<td align="center">';
echo '<input type="checkbox" name=choix value='.$s.'>';
echo '</td>';
//echo '<td>';
//echo $s;
//echo '</td>';
echo '</tr>';
}?>
<?php }
?>
</table>
<input type="submit" value="Valider">
</form>
Salut,
heuu oui j'ai une question, j'ai juste compris que tu as un problème de checkbox, mais je n'ai pas compris ou est le problème. Sinon à par ça je lis dans ton code : type="checkbox" name=choix Alors les guillemets tu es met ou tu les mets pas, ça dépend du doctype choisie, il vaut mieux les mettre. Tous en bas il y a aussi ça : ?> <?php Il est inutile de fermer pour rouvrir juste après. |