Eléphanteau du PHP |
48 Messages
26 févr. 2010, 10:55
Bon, à priori, ca marche toujours pas... Je dois pas avoir les yeux en face des trous ce matin...
<form method="post" action="<?php $_SERVER['PHP_SELF'];?>">
<select name="service-test" id="service-test">
<option value="<?php if (empty($serv)) { echo "selected"; } ?>">Service à sélectionner</option>
<?php
$sqlserv = "SELECT DISTINCT service FROM agent ORDER BY service";
$resultatserv = mysql_query ($sqlserv, $connexion);
while ($tabserv = mysql_fetch_array($resultatserv, MYSQL_ASSOC))
{
?>
<option value="<?php echo $tabserv['service']; ?>"<?php if ($serv == $tabserv['service']) { echo " selected"; } ?>><?php echo strtolower($tabserv['service']); ?></option>
<?php
}
?>
</select>
<input type="submit" value="OK">
</form>
<?php
if(isset($_POST['serv'])) {
// on créé la requête SQL
$sql = "SELECT description,id_produit,statut,id,num_commande,qte_produit,date_commande,agent,nomagent,prenomagent,service,idagent FROM fourniture_commande,agent,fourniture_produits WHERE fourniture_commande.num_commande LIKE'RSI052010%' AND fourniture_produits.id=fourniture_commande.id_produit AND fourniture_commande.agent=agent.idagent AND statut='livrée' AND qte_produit>'0' AND service=".$service;
// on envoie la requête
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
// on fait une boucle qui va faire un tour pour chaque enregistrement
while($data = mysql_fetch_assoc($req))
{
// on affiche les informations de l'enregistrement en cours
echo '<font face="Freestyle Script" color="#0099CC" size="+2"><b>Service :</b></font>'.$service.'<br>';
.....