Bonjour,
Je suis totalement novice en javascript, et du coup je préfèrerais trouver une solution en php, cependant je pense que c'est impossible.
Voilà mes deux problèmes :
J'ai une page de recherche : Search.html :
Code HTML : 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 <div id="contenu"> <p> <FORM action="Results.php" method="post"> <table width=640px> <tr> <td>Complaint number : <br>(year - number) </td> <td><INPUT TYPE=text NAME=CompNb1 size=5 maxlength=4> - <INPUT TYPE=text NAME=CompNb2 size=5 maxlength=4></td> </tr> <tr> <td width=25%><br>Complainant name : </td> <td width=75%><br><INPUT TYPE=text NAME=CompName size=30></td> </tr> </table> <table width=100%> <tr> <td width=25%>Status : <select name=status> <option value="%"></option> <option value="Op">Opened</option> <option value="UI">Under investigation</option> <option value="SP">Solution proposed</option> <option value="SA">Solution applied</option> <option value="Cl">Closed</option> </select> </td> <td width=27%>Problem type : <select name=problemType> <option value="%"></option> <option value="NEP">No existing process</option> <option value="PNC">Process not cleard</option> <option value="PNA">Process not applied</option> <option value="Del">Delay</option> <option value="Oth">Other</option> </select> </td> <td width=15%>Origin : <br><select name=natco> <option value="%"></option> <option value="CE">CE</option> <option value="AD">A-D</option> <option value="AE">A-E</option> <option value="AF">A-F</option> <option value="AU">A-UK</option> </select> </td> <td width=25%>LOS : <br><select name=los> <option value="%"></option> <option value="DM">DM</option> <option value="SD">SD</option> <option value="RM">RM</option> <option value="Ot">Other</option> </select> </td> </tr> </table> <br> <table> <tr> <td width=25%>Complaint reception date : <br><i></td> <td width=75%>between the <INPUT TYPE=date NAME=date1 size=6 maxlength=10> and <INPUT TYPE=date NAME=date2 size=6 maxlength=10></td> </tr> <tr> <td><br><INPUT TYPE=submit VALUE=" Ok "></td> <td><br><i>Help : The date must be seized in the form YYYY-MM-DD</i></td> <td></td> <td></td> <tr> </table> </FORM> </p> </div>
Et j'ai donc une saisie de deux dates pour lesquelles je souhaiterais gérer un calendrier.
Voilà le code de mon calendrier : calendar.php :
Seulement je voudrais savoir comment récupérer le jour, le mois et l'année, si on clique sur un des jour (j'ai mis "..." dans le a href car je ne sais pas comment le gérer)?
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 <html> <head> <style> div#calendar th { color : darkblue; font-size:13; font-family:Helvetica; font-weight:400; text-decoration: none ; } div#calendar th a { color : darkblue; font-size:13; font-family:Helvetica; font-weight:400; text-decoration: none ; } </style> </head> <body> <?php //Creating general vars $year = date("Y"); if(!isset($_GET['month'])) $monthnb = date("n"); else { $monthnb = $_GET['month']; $year = $_GET['year']; if($monthnb <= 0) { $monthnb = 12; $year = $year - 1; } elseif($monthnb > 12) { $monthnb = 1; $year = $year + 1; } } $day = date("w"); $nbdays = date("t", mktime(0,0,0,$monthnb,1,$year)); $firstday = date("w",mktime(0,0,0,$monthnb,1,$year)); //Replace the number of the day by its french name $daytab[1] = 'Mon'; $daytab[2] = 'Tue'; $daytab[3] = 'Wed'; $daytab[4] = 'Thu'; $daytab[5] = 'Fri'; $daytab[6] = 'Sat'; $daytab[7] = 'Sun'; //Build the calendar table $calendar = array(); $z = (int)$firstday; if($z == 0) $z =7; for($i = 1; $i <= ($nbdays/5); $i++){ for($j = 1; $j <= 7 && $j-$z+1+(($i*7)-7) <= $nbdays; $j++){ if($j < $z && ($j-$z+1+(($i*7)-7)) <= 0){ $calendar[$i][$j] = null; } else { $calendar[$i][$j] = $j-$z+1+(($i*7)-7); } } } //Replace the number of the month by its french name switch($monthnb) { case 1: $month = 'January'; break; case 2: $month = 'February'; break; case 3: $month = 'March'; break; case 4: $month = 'April'; break; case 5: $month = 'May'; break; case 6: $month = 'June'; break; case 7: $month = 'July'; break; case 8: $month = 'August'; break; case 9: $month = 'September'; break; case 10: $month = 'October'; break; case 11: $month = 'November'; break; case 12: $month = 'December'; break; } ?> <div id="calendar"> <table width=25% border=1> <tr> <th><span class="linkcal"><a href="calendar.php?month=<?php echo $monthnb - 1; ?>&year=<?php echo $year; ?>"><img src='img/bef.bmp'></a></span></th> <th colspan="5" class="headcal"><b><?php echo($month.' '.$year); ?></b></th> <th><span class="linkcal"><a href="calendar.php?month=<?php echo $monthnb + 1; ?>&year=<?php echo $year; ?>"><img src='img/aft.bmp'></a></span></th> </tr> <?php echo('<tr>'); for($i = 1; $i <= 7; $i++){ echo('<th width=5%><i>'.$daytab[$i].'</i></th>'); } echo('</tr>'); for($i = 1; $i <= count($calendar); $i++) { echo('<tr>'); for($j = 1; $j <= 7 && $j-$z+1+(($i*7)-7) <= $nbdays; $j++){ if($j-$z+1+(($i*7)-7) == date("j") && $monthnb == date("n") && $year == date("Y")) echo('<th class="current"><a href="...">'.$calendar[$i][$j].'</a></th>'); else echo('<th><a href=\"\">'.$calendar[$i][$j].'</a></th>'); } echo('</tr>'); } ?> </table> </div> </body> </html>
De plus je voudrais mettre en place une gestion assez commune du calendrier. Sur ma page de recherche à côté des input de dates, je voudrais avoir une petit icône représentant un calendrier (ça je saurais faire je pense). Mais une fois cliqué sur cette icône je souhaiterais qu'un popup s'ouvre avec mon calendrier. Et qu'une fois avoir cliqué sur le jour du calendrier, que le popup se ferme, et renvoie dans le input de la date associée, l'année-le mois-le jour sélectionné dans le calendrier.
Est ce possible ?
Partager