1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type">
<title></title>
<form enctype="application/x-www-form-urlencoded"
method="get" action="insert-culture.php" name="cultiv">
</head>
<body>
<?php
include("base.php");
$nombrlarg=$_REQUEST['largeur']/0.2;
$nombrlong=$_REQUEST['Longueur']/0.2;
$sqldel= "delete from temp";
mysql_query($sqldel)or die(mysql_error());
$sql= "SELECT compatible1,compatible2, compatible3, compatible4,compatible5 FROM potager ";
$resultat=mysql_query($sql);
while ($leg = mysql_fetch_assoc($resultat)){
$leg1=$leg['compatible1'];
$leg2=$leg['compatible2'];
$leg3=$leg['compatible3'];
$leg4=$leg['compatible4'];
$leg5=$leg['compatible5'];
$sql2="Insert into temp (`ID`,`liste` ) VALUES ('','$leg1')";
mysql_query($sql2)or die(mysql_error());
$sql3="insert into temp (`ID`,`liste` ) VALUES ('','$leg2')";
mysql_query($sql3)or die(mysql_error());
$sql4="insert into temp (`ID`,`liste` ) VALUES ('','$leg3')";
mysql_query($sql4)or die(mysql_error());
$sql5="insert into temp (`ID`,`liste` ) VALUES ('','$leg4')";
mysql_query($sql5)or die(mysql_error());
$sql6="insert into temp (`ID`,`liste` ) VALUES ('','$leg5')";
mysql_query($sql6)or die(mysql_error());
}
?>
<table style="text-align: left; width: 883px; height: 154px;"
border="1" cellpadding="2" cellspacing="2">
<tbody>
année de culture
<select name="an" id="an" >
<option value="2008">2008</option>
<option value="2009">2009
</option>
</select>
<?php
include("base.php");
// variable pour le nombre de cases
$largeur1=0;
echo "<tr>";
$legume='legume'+1.;
// continue a créer des cases quand la largeur n'est pa atteinte
while ($largeur1<>$nombrlarg){
echo "<TD><select name=$legume id=$legume >";
// création d'une liste defilante de choix
$sql= "SELECT DISTINCT (liste) FROM temp ORDER BY liste";
$resultat=mysql_query($sql);
while ($leg = mysql_fetch_assoc($resultat)){
$leg1=$leg['liste'];
$option="<option value=$leg1> $leg1 </option></select>";
echo $option.'</td>'; }
$largeur1=$largeur1+1;
}
?>
</tbody>
</table>
<br>
<button type="submit">val'ider</button></form>
</body>
</html> |
Partager