C'est l'accolade tout en bas qui me pose problème. Ma requête d'insertion en bas n'insert rien, et je ne comprend pas pourquoi.
<?php
if(isset($_POST['liste1'])){
//si la liste a été "postée" c'est à dire choix fait
$liste1=$_POST['liste1'];
}else{
$liste1=-1;
}
?>
<legend>Sélectionnez un chariot :</legend>
<form name="form1" method="post" action="">
<select name="liste1" onchange=" form1.submit();">
<option value=-1>-- Choisissez -- </option>
<?php
include('connection.inc.php');
$requete = "SELECT n_parc FROM chariot";
$execution_requete = mysql_query($requete);
while($total = mysql_fetch_array($execution_requete))
//Liste déroulante
{
echo "<option value=\"".$total["n_parc"]."\"";
if($liste1==$total['n_parc']) { echo "selected"; }//ça c'est pour garder la selection lors du réaffichage
echo ">".$total['n_parc']."</option>\n";
}
?>
</select>
</form>
<?php
if($liste1 != -1){
$requete = "SELECT type, energie, marque, modele, n_serie, annee, n_parc, idchariot FROM chariot WHERE n_parc ='".$liste1."'";
$execution_requete = mysql_query($requete);
$total = mysql_fetch_array($execution_requete);
// } si on déplace cette accolade plus bas ça a l'avantage de na pas afficher la partie Informations tant que le choix n'a pas été fait dans la lsite1
?>
<table border="1" cellspacing="0" cellpadding="8" align="left" bgcolor="#FFFFFF" >
<tr>
<td align="center" bgcolor="#FFFFFF"><b><u>Type</u></b></td>
<td align="center" bgcolor="#FFFFFF"><b><u>Energie</u></b></td>
<td align="center" bgcolor="#FFFFFF"><b><u>Marque</u></b></td>
<td align="center" bgcolor="#FFFFFF"><b><u>Modéle</u></b></td>
<td align="center" bgcolor="#FFFFFF"><b><u>N° série</u></b></td>
<td align="center" bgcolor="#FFFFFF"><b><u>N° parc</u></b></td>
<td align="center" bgcolor="#FFFFFF"><b><u>Année</u></b></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><?php echo $total['type'] ?></td>
<td bgcolor="#FFFFFF"><?php echo $total['energie'] ?></td>
<td bgcolor="#FFFFFF"><?php echo $total['marque'] ?></td>
<td bgcolor="#FFFFFF"><?php echo $total['modele'] ?></td>
<td bgcolor="#FFFFFF"><?php echo $total['n_serie'] ?></td>
<td bgcolor="#FFFFFF"><?php echo $total['n_parc'] ?></td>
<td bgcolor="#FFFFFF"><?php echo $total['annee'] ?></td>
</tr>
</table>
<input type="hidden" name="idchariot" value="<?php echo $total['idchariot'] ?>">
<br><br><br><br><br><br><br>
<?php
$idchariot = $total['idchariot'];
$requete1 = 'SELECT effectue, societe, idchariot FROM suivi_vr WHERE idchariot = '.$idchariot.' ORDER BY effectue DESC LIMIT 1';
$execution_requete1 = mysql_query($requete1) or die(mysql_error());
$total1 = mysql_num_rows($execution_requete1) or die(mysql_error());
if($total1) {
?>
<table border="0" cellspacing="0" cellpadding="5" align="left" bgcolor="#FEAE5E" >
<tr>
<td colspan="2" align="center" bgcolor="#FEAE5E"><b><u>VR 1</u></b></td>
</tr>
<tr>
<td align="center" bgcolor="#FEAE5E"><b><u></u>Date</b></td>
<td align="center" bgcolor="#FEAE5E"><b><u></u>Société</b></td>
</tr>
<tr>
<?php while($row = mysql_fetch_array($execution_requete1)) { ?>
<td align="center" bgcolor="#FEAE5E"><?php echo $row['effectue'] ?></td>
<td align="center" bgcolor="#FEAE5E"><?php echo $row['societe'] ?></td>
<td align="center" bgcolor="#FEAE5E"><b><u></u></b></td>
</tr>
<?php } ?>
</table>
<?php } ?>
<?php
$idchariot = $total['idchariot'];
$requete2 = 'SELECT effectue2, societe2, idchariot FROM suivi_vr2 WHERE idchariot = '.$idchariot.' ORDER BY effectue2 DESC LIMIT 1';
$execution_requete2 = mysql_query($requete2) or die(mysql_error());
$total2 = mysql_num_rows($execution_requete2) or die(mysql_error());
if($total2) {
?>
<table border="0" cellspacing="0" cellpadding="5" align="left" bgcolor="#CCCCCC" >
<tr>
<td colspan="2" align="center" bgcolor="#CCCCCC"><b><u>VR 2</u></b></td>
</tr>
<tr>
<td align="center" bgcolor="#CCCCCC"><b><u>Date</u></b></td>
<td align="center" bgcolor="#CCCCCC"><b><u>Société</u></b></td>
</tr>
<tr>
<?php while($row = mysql_fetch_array($execution_requete2)) { ?>
<td align="center" bgcolor="#CCCCCC"><?php echo $row['effectue2'] ?></td>
<td align="center" bgcolor="#CCCCCC"><?php echo $row['societe2'] ?></td>
<td align="center" bgcolor="#CCCCCC"><b><u></u></b></td>
</tr>
<?php } ?>
</table>
<?php } ?>
<br><br><br><br><br><br>
<div id="tableau1">
<form method="post" action="">
<table cellspacing="7" BORDER="0">
<tr>
<th bgcolor="#E9F19E">Période VR 1:</th>
</tr>
<tr>
<th>Entre le :</th>
<td><input type="text" name="entre_le" size="10" name="entre_le" id="entre_le" onfocus="view_microcal(true,entre_le,microcal,-1,0);" onblur="view_microcal(false,entre_le,microcal,-1,0);" onkeyup="this.style.color=testTypeDate(this.value)?'black':'red'"></TD>
<td><div id="microcal" style="visibility:hidden;position:absolute;border:0px red dashed;background:#ffffff;"></div></td>
<th>Et le :</th>
<td><input type="text" name="et_le" size="10" name="et_le" id="et_le" onfocus="view_microcal(true,et_le,microcal2,-1,0);" onblur="view_microcal(false,et_le,microcal2,-1,0);" onkeyup="this.style.color=testTypeDate(this.value)?'black':'red'"></TD>
<td><div id="microcal2" style="visibility:hidden;position:absolute;border:0px red dashed;background:#ffffff;"></div></td>
</tr>
<tr>
<td align="left"><input type="submit" name="enregistrer1" value=" Valider " ></td>
</tr>
</table>
</form>
</div>
<div id="tableau2">
<form method="post" action="">
<table cellspacing="7" BORDER="0">
<tr>
<th bgcolor="#CCCCCC">Période VR 2:</th>
</tr>
<tr>
<th>Entre le :</th>
<td><input type="text" name="entre_le" size="10" name="entre_le" id="entre_le" onfocus="view_microcal(true,entre_le,microcal3,-1,0);" onblur="view_microcal(false,entre_le,microcal3,-1,0);" onkeyup="this.style.color=testTypeDate(this.value)?'black':'red'"></TD>
<td><div id="microcal3" style="visibility:hidden;position:absolute;border:0px red dashed;background:#ffffff;"></div></td>
<th>Et le :</th>
<td><input type="text" name="et_le" size="10" name="et_le" id="et_le" onfocus="view_microcal(true,et_le,microcal4,-1,0);" onblur="view_microcal(false,et_le,microcal4,-1,0);" onkeyup="this.style.color=testTypeDate(this.value)?'black':'red'"></TD>
<td><div id="microcal4" style="visibility:hidden;position:absolute;border:0px red dashed;background:#ffffff;"></div></td>
</tr>
<tr>
<td align="left"><input type="submit" name="enregistrer2" value=" Valider " ></td>
</tr>
</table>
</form>
</div>
<div id="calendrier_suivi">
<table border="1" cellspacing="0" cellpadding="4" align="left" bgcolor="#FFFFFF" >
<tr>
<td align="center" bgcolor="#FFFFFF"><b><u>Jan</u></b></td>
<td align="center" bgcolor="#FFFFFF"><b><u>Fév</u></b></td>
<td align="center" bgcolor="#FFFFFF"><b><u>Mars</u></b></td>
<td align="center" bgcolor="#FFFFFF"><b><u>Avr</u></b></td>
<td align="center" bgcolor="#FFFFFF"><b><u>Mai</u></b></td>
<td align="center" bgcolor="#FFFFFF"><b><u>Juin</u></b></td>
<td align="center" bgcolor="#FFFFFF"><b><u>Juil</u></b></td>
<td align="center" bgcolor="#FFFFFF"><b><u>Aout</u></b></td>
<td align="center" bgcolor="#FFFFFF"><b><u>Sept</u></b></td>
<td align="center" bgcolor="#FFFFFF"><b><u>Oct</u></b></td>
<td align="center" bgcolor="#FFFFFF"><b><u>Nov</u></b></td>
<td align="center" bgcolor="#FFFFFF"><b><u>Déc</u></b></td>
</tr>
<tr>
<td align="center"><img src="images/puce_rouge.gif" onclick ="couleur(this)"></td>
<td align="center"><img src="images/puce_rouge.gif" onclick ="couleur(this)"></td>
<td align="center"><img src="images/puce_rouge.gif" onclick ="couleur(this)"></td>
<td align="center"><img src="images/puce_rouge.gif" onclick ="couleur(this)"></td>
<td align="center"><img src="images/puce_rouge.gif" onclick ="couleur(this)"></td>
<td align="center"><img src="images/puce_rouge.gif" onclick ="couleur(this)"></td>
<td align="center"><img src="images/puce_rouge.gif" onclick ="couleur(this)"></td>
<td align="center"><img src="images/puce_rouge.gif" onclick ="couleur(this)"></td>
<td align="center"><img src="images/puce_rouge.gif" onclick ="couleur(this)"></td>
<td align="center"><img src="images/puce_rouge.gif" onclick ="couleur(this)"></td>
<td align="center"><img src="images/puce_rouge.gif" onclick ="couleur(this)"></td>
<td align="center"><img src="images/puce_rouge.gif" onclick ="couleur(this)"></td>
</tr>
</table>
</div>
</div>
<div id="date_verif">
<?php
if (isset($_POST['enregistrer3'])) {
$effectue = $_POST['effectue'];
$effectue2 = $_POST['effectue2'];
$societe = $_POST['societe'];
$idchariot = $total['idchariot'];
$req = mysql_query("INSERT INTO suivi_vr (idvr, idchariot, effectue, societe) VALUES ('', '$idchariot', '$effectue', '$societe')");
}
?>
<form method="post" action="">
<table cellspacing="1" BORDER="0">
<tr>
<th style="white-space: nowrap;" align="left">Date de la visite :<th>
<td><input type="text" name="effectue" value="" size="15"></td>
</tr>
<tr>
<th align="left">Socièté :<th>
<td><input type="text" name="societe" value="" size="15"></td>
</tr>
<tr>
<td><input type="submit" name="enregistrer3" value="Enregistrer"></td>
<td style="white-space: nowrap;"><input type= "radio" name="type" value="oui" checked="checked"> VR 1</td>
<td style="white-space: nowrap;"><input type= "radio" name="type" value="non"> VR 2</td>
</tr>
</table>
</form>
</div>
<div class="post">
</div>
</div>
<?php
} // accolade de fin de if liste postee
?>
</div>
</body>
</html>