bonjour,
je fais appel à vous car je bloque sur un problème et je n' arrive pas a le résoudre.
j' ai 2 formulaires, 1 qui fait la saisie, l'autre le planning.
pour la saisie:
j'ai plusieurs zone de texte qui géré la date de début et date de fin pour effectuer un enregistrement.
ci joint le .php (cette page ne me pose pas de soucis.
ce que j'aimerai faire c'est d'arriver a faire la liaison des dates (jour_debut et jour_fin) dans le tableau d'affichage de telle sorte que je puisse afficher le produit en fonction de la date (la date peut etre sur 1 journée, ou 1 periode (3, 4 jours ou plus)
saisie.php
planning.php
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152 <?php $req=$pdo->prepare("UPDATE planning SET PRODUITS =:produits, JOUR_DEBUT=:jour_debut, JOUR_FIN=:jour_fin WHERE ID=:id") ; $req->execute(array( ':produits'=>$produits, ':jour_debut' =>$annee.'-'.$mois.'-'.$jour, ':jour_fin' =>$anneef.'-'.$moisf.'-'.$jourf, ':id' =>$Salle )) ; var_dump($req); $req->closeCursor(); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Messagerie au Support </title> </head> <body> <form method="post" action="saisie.php"> <?php if(isset($erreur_date)) echo'<span>'.$erreur_date.'</span><br />'; if(isset($erreur_heure)) echo'<span>'.$erreur_heure.'</span><br />'; ?> <label for="jour">jour début</label><br /> <select name="jour"> <?php $i=1; while($i<=31){ if((isset($jour)) && ($jour==$i)){ echo '<option value="'.$i.'"selected>'.$i.'</option>'; }else{ echo '<option value="'.$i.'">'.$i.'</option>'; } $i++; } ?> </select> <select name="mois"> <?php $mois_francais=array('','Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Août','Septembre','Octobre','Novembre','Décembre') ; $i=1; while($i<=12){ if((isset($mois)) && ($mois==$i)){ echo '<option value="'.$i.'"selected>'.$mois_francais[$i].'</option>'; }else{ echo '<option value="'.$i.'">'.$mois_francais[$i].'</option>'; } $i++; } ?> </select> <select name="annee"> <?php $année_actuelle=date('Y') ; $i=0; while($i<3){ $annees =$année_actuelle + $i; if((isset($annee)) && ($annee==$annees)){ echo '<option value="'.$annees.'"selected>'.$annees.'</option>'; }else{ echo '<option value="'.$annees .'">'.$annees .'</option>'; } $i++; } ?> </select> <br /> <label for="jourf">jour fin</label><br /> <select name="jourf"> <?php $i=1; while($i<=31){ if((isset($jourf)) && ($jourf==$i)){ echo '<option value="'.$i.'"selected>'.$i.'</option>'; }else{ echo '<option value="'.$i.'">'.$i.'</option>'; } $i++; } ?> </select> <select name="moisf"> <?php $moisf_francais=array('','Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Août','Septembre','Octobre','Novembre','Décembre') ; $i=1; while($i<=12){ if((isset($moisf)) && ($moisf==$i)){ echo '<option value="'.$i.'"selected>'.$moisf_francais[$i].'</option>'; }else{ echo '<option value="'.$i.'">'.$moisf_francais[$i].'</option>'; } $i++; } ?> </select> <select name="anneef"> <?php $année_actuelle=date('Y') ; $i=0; while($i<3){ $anneesf =$année_actuelle + $i; if((isset($anneef)) && ($anneef==$anneesf)){ echo '<option value="'.$anneesf.'"selected>'.$anneesf.'</option>'; }else{ echo '<option value="'.$anneesf .'">'.$anneesf .'</option>'; } $i++; } ?> </select> <br /> <?php if(isset($erreur_produits)) echo'<span>'.$erreur_produits.'</span><br />'; ?> <label for="Salle">Salle</label> <br /> <select name="Salle"> <option value="">Selectionner</option> <option value="SALLE_1">SALLE 1</option> <option value="SALLE_2">SALLE 2</option> <option value="SALLE_3">SALLE 3</option> <option value="SALLE_4">SALLE 4</option> <option value="SALLE_5">SALLE 5</option> <option value="COURS">COURS</option> <option value="VESTIAIRE">VESTIAIRE</option> </select> <br /> <label for="produits">produits</label> <br /> <input type="text" name="produits" value="<?php if(isset($produits)) echo $produits;?>" /> <br /> <input type="submit" value="Enregister" /> </form> </body> </html>
merci pour votre aide
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102 <?php $week=date("W"); function get_lundi_dimanche_from_week($week,$year,$format="d/m/Y") { $firstDayInYear=date("N",mktime(0,0,0,1,1,$year)); if ($firstDayInYear<7) $shift=-($firstDayInYear-1)*86400; else $shift=(8-$firstDayInYear)*86400; if ($week>1) $weekInSeconds=($week-1)*604800; else $weekInSeconds=0; $timestamp=mktime(0,0,0,1,1,$year)+$weekInSeconds+$shift; $timestamp_mardi=mktime(0,0,0,1,2,$year)+$weekInSeconds+$shift; $timestamp_mercredi=mktime(0,0,0,1,3,$year)+$weekInSeconds+$shift; $timestamp_jeudi=mktime(0,0,0,1,4,$year)+$weekInSeconds+$shift; $timestamp_vendredi=mktime(0,0,0,1,5,$year)+$weekInSeconds+$shift; $timestamp_samedi=mktime(0,0,0,1,6,$year)+$weekInSeconds+$shift; $timestamp_dimanche=mktime(0,0,0,1,7,$year)+$weekInSeconds+$shift; return array("Lundi " . date($format,$timestamp),"Mardi " . date($format,$timestamp_mardi),"Mercredi " . date($format,$timestamp_mercredi),"Jeudi " . date($format,$timestamp_jeudi),"Vendredi " . date($format,$timestamp_vendredi),"Samedi " . date($format,$timestamp_samedi),"Dimanche " . date($format,$timestamp_dimanche)); } $debut_fin_semaine = get_lundi_dimanche_from_week($week,2015); echo "Semaine du : " .$debut_fin_semaine[0] . " au " . $debut_fin_semaine [6]; ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>Gestion des Salles</title> </head> <body> <table border="1" width="1600" cellspacing="1" cellpadding="30"> <?php $NbrLigne = 7; ?> <tr> <td style="background:#CCCCCC;">Salles</td> <td Lundi ><?php echo $debut_fin_semaine[0]; ?></td> <td Mardi><?php echo $debut_fin_semaine[1]; ?></td> <td Mercredi><?php echo $debut_fin_semaine[2]; ?></td> <td Jeudi><?php echo $debut_fin_semaine[3]; ?></td> <td Vendredi><?php echo $debut_fin_semaine[4]; ?></td> <td Samedi><?php echo $debut_fin_semaine[5]; ?></td> <td Dimanche><?php echo $debut_fin_semaine[6]; ?></td> </tr> <?php for ($i=1; $i<=$NbrLigne; $i++) { ?> <tr> <td> <?php if ($i==1){ echo " Salle 1 "; } if ($i==2){ echo " Salle 2 "; } if ($i==3){ echo " Salle 3 "; } if ($i==4){ echo " Salle 4 "; } if ($i==5){ echo " Salle 5 "; } if ($i==6){ echo " Cours "; } if ($i==7){ echo " Vestiaires "; } ?> </td> <td></td> <td ></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <?php } ?> </table> </body> </html>
Partager