Bonjour,

Je suis actuellement entrain de mettre en place un formulaire ... et chose incompréhensible ... aucun message d'erreur, et le code HTML ne s'affiche pas ... Je n'y comprends rien.

Les conditions PHP fonctionne ... mais pas le code HTML.

Pouvez vous m'aider ... Voici mes 2 pages !

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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
<html>
<head>  
<style type='text/css'>
body {
	font-family:"Lucida sans unicode", sans-serif;
	font-size:12px;
	margin:0;
	padding:0;
	height:100%;
	}
#basis {
	display:inline;
	position:relative;
	}
#calender {
	position:absolute;
	top:30px;
	left:0;
	width:220px;
	background-color:#fff;
	border:3px solid #ccc;
	padding:10px;
	z-index:10;
	}
#control {
	text-align:center;
	margin:0 0 5px 0;
	}
#control select {
	font-family:"Lucida sans unicode", sans-serif;
	font-size:11px;
	margin:0 5px;
	vertical-align:middle;
	}
#calender .controlPlus {
	padding:0 5px;
	text-decoration:none;
	color:#333;
	}
#calender table {
	empty-cells: show;
	width:100%;
	font-size:11px;
	table-layout:fixed;
	}
#calender .weekdays td{
	text-align:right;
	padding:1px 5px 1px 1px;
	color:#333;
	}
#calender .week td {
	text-align:right;
	cursor:pointer;
	border:1px solid #fff;
	padding:1px 4px 1px 0;
	}
#calender .week .today { 
	background-color:#ccf;
	border-color:#ccf;
	}
#calender .week .holiday {
	font-weight: bold;
	}
#calender .week .hoverEle {
	border-color:#666;
	background-color:#99f;
	color:#000;
	}
 
</style>
<script  type="text/javascript">
	var allMonth=[31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
	var allNameOfWeekDays=["Lu","Ma", "Mer", "Jeu", "Ven", "Sam", "Dim"];
	var allNameOfMonths=["Janvier","Fevrier","Mars","Avril","Mai","Juin","Juillet","Aout","Septembre","Octobre","Novembre","Decembre"];
	var newDate=new Date();
	var yearZero=newDate.getFullYear();
	var monthZero=newDate.getMonth();
	var day=newDate.getDate();
	var currentDay=0, currentDayZero=0;
	var month=monthZero, year=yearZero;
	var yearMin=2000, yearMax=2010;
	var target='';
	var hoverEle=false;
	function setTarget(e){
		if(e) return e.target;
		if(event) return event.srcElement;
	}
	function newElement(type, attrs, content, toNode) {
		var ele=document.createElement(type);
		if(attrs) {
			for(var i=0; i<attrs.length; i++) {
				eval('ele.'+attrs[i][0]+(attrs[i][2] ? '=\u0027' :'=')+attrs[i][1]+(attrs[i][2] ? '\u0027' :''));
			}
		}
		if(content) ele.appendChild(document.createTextNode(content));
		if(toNode) toNode.appendChild(ele);
		return ele;
	}
	function setMonth(ele){month=parseInt(ele.value);calender()}
	function setYear(ele){year=parseInt(ele.value);calender()}
	function setValue(ele) {
		if(ele.parentNode.className=='week' && ele.firstChild){
			var dayOut=ele.firstChild.nodeValue;
			if(dayOut < 10) dayOut='0'+dayOut;
			var monthOut=month+1;
			if(monthOut < 10) monthOut='0'+monthOut;
			target.value=dayOut+'/'+monthOut+'/'+year;
			removeCalender();
		}
	}
	function removeCalender() {
		var parentEle=document.getElementById("calender");
		while(parentEle.firstChild) parentEle.removeChild(parentEle.firstChild);
		document.getElementById('basis').parentNode.removeChild(document.getElementById('basis'));
	}		
	function calender() {
		var parentEle=document.getElementById("calender");
		parentEle.onmouseover=function(e) {
			var ele=setTarget(e);
			if(ele.parentNode.className=='week' && ele.firstChild && ele!=hoverEle) {
				if(hoverEle) hoverEle.className=hoverEle.className.replace(/hoverEle ?/,'');
				hoverEle=ele;
				ele.className='hoverEle '+ele.className;
			} else {
				if(hoverEle) {
					hoverEle.className=hoverEle.className.replace(/hoverEle ?/,'');
					hoverEle=false;
				}
			}
		}
		while(parentEle.firstChild) parentEle.removeChild(parentEle.firstChild);
		function check(){
			if(year%4==0&&(year%100!=0||year%400==0))allMonth[1]=29;
			else allMonth[1]=28;
		}
		function addClass (name) { if(!currentClass){currentClass=name} else {currentClass+=' '+name} };
		if(month < 0){month+=12; year-=1}
		if(month > 11){month-=12; year+=1}
		if(year==yearMax-1) yearMax+=1;
		if(year==yearMin) yearMin-=1;
		check();
		var control=newElement('p',[['id','control',1]],false,parentEle);
		var controlPlus=newElement('a', [['href','javascript:month--;calender()',1],['className','controlPlus',1]], '<', control);
		var select=newElement('select', [['onchange',function(){setMonth(this)}]], false, control);
		for(var i=0; i<allNameOfMonths.length; i++) newElement('option', [['value',i,1]], allNameOfMonths[i], select);
		select.selectedIndex=month;
		select=newElement('select', [['onchange',function(){setYear(this)}]], false, control);
		for(var i=yearMin; i<yearMax; i++) newElement('option', [['value',i,1]], i, select);
		select.selectedIndex=year-yearMin;
		controlPlus=newElement('a', [['href','javascript:month++;calender()',1],['className','controlPlus',1]], '>', control);
		check();
		currentDay=1-new Date(year,month,1).getDay();
		if(currentDay > 0) currentDay-=7;
		currentDayZero=currentDay;
		var newMonth=newElement('table',[['cellSpacing',0,1],['onclick',function(e){setValue(setTarget(e))}]], false, parentEle);
		var newMonthBody=newElement('tbody', false, false, newMonth);
		var tr=newElement('tr', [['className','head',1]], false, newMonthBody);
		tr=newElement('tr', [['className','weekdays',1]], false, newMonthBody);
		for(i=0;i<7;i++) td=newElement('td', false, allNameOfWeekDays[i], tr);	
		tr=newElement('tr', [['className','week',1]], false, newMonthBody);
		for(i=0; i<allMonth[month]-currentDayZero; i++){
			var currentClass=false;			
			currentDay++;
			if(currentDay==day && month==monthZero && year==yearZero) addClass ('today');
			if(currentDay <= 0 ) {
				if(currentDayZero!=-7) td=newElement('td', false, false, tr);
			}
			else {
				if((currentDay-currentDayZero)%7==0) addClass ('holiday');
				td=newElement('td', (!currentClass ? false : [['className',currentClass,1]] ), currentDay, tr);
				if((currentDay-currentDayZero)%7==0) tr=newElement('tr', [['className','week',1]], false, newMonthBody);
			}
			if(i==allMonth[month]-currentDayZero-1){
				i++;
				while(i%7!=0){i++;td=newElement('td', false, false, tr)};
			}
		}
	}
	function showCalender(ele) {
		if(document.getElementById('basis')) { removeCalender() }
		else {
			target=document.getElementById(ele.id.replace(/for_/,'')); 
			var basis=ele.parentNode.insertBefore(document.createElement('div'),ele);
			basis.id='basis';
			newElement('div', [['id','calender',1]], false, basis);
			calender();
		}
	}
</script>
</head>
<body>
<?php
//Connexion à la base
$db=mysql_connect("localhost","root","");
 
//Selection de la base
mysql_select_db("alliance",$db);
 
//Récuperation de l'id
$id=$_GET['id']; 
 
//déclaration des variables
$dat_ret = "SELECT idspare_pr,nomspare,emprunteur,Date_ret FROM pr_spare WHERE idspare_pr='$id'";
$req_dat_ret = mysql_query($dat_ret) or die ("erreur de connexion");
 
//affichage des données
echo '<table border="0">';
echo '<font face="arial" size="1"><u><strong>Information</u></font>';
while($data_info=mysql_fetch_array($req_dat_ret))
	  {
	  echo '<br>';
	  echo '<font face="arial" size="1">'.$data_info['nomspare'].' emprunté par '.$data_info['emprunteur'].'</font>';
	  }
echo '</table>';
 
if($result = mysql_fetch_row($req_dat_ret))
{
?>
<form name="modif_dat_ret" action="?numlien=modif_date" method="POST">
	  <input type="hidden" name="id" value="<? echo($id); ?>">
	  		 <table border="0" align="center">
			 		<tr align="left" border="1">
						<td><font face="arial" size="2">Modification de la date de retour</font></td>
								  <td>
								  	  <input type="text" name="z_date_ret" id='date' size="8" /><img src="image/cal.bmp" width="16" height="16" border="0" alt="Sélectionnez la date" id='for_date' onclick='showCalender(this)' /></a>
									  		 </td>
											 	  <tr align="center">
      										 	 				<td colspan="2"><input type="submit" value="Valider"></td>
											 	  </tr>
												  	   </table>
													   		   </form>
<?
  }//fin if 
?>
</body>
<?
echo '<font face=arial"><a href=>Retour</a></font>';
mysql_close();
?>
</html>
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
<?php /* Date de création: 09/02/2007 */ ?>
<html>
<body>
<?php
//connection au serveur
  $cnx=mysql_connect( "localhost", "root", "" );
 
  //sélection de la base de données:
  $db=mysql_select_db("alliance");
 
  //appel fichier fonction.php
  require("fonctions.php");
 
 //récupération des valeurs des champs:
 $z_date_ret=$_POST['z_date_ret'];
 
 $z_date_ret_en = datefr2en($z_date_ret); 
 
 //récupération de l'ID:
 $id=$_POST['id'];
 
 $sql="UPDATE pr_spare SET Date_ret='$z_date_ret_en' WHERE idspare_pr='$id'";
 
 //création de la requête SQL:
 $requete = mysql_query($sql) or die( mysql_error());
 
 //affichage des résultats, pour savoir si la modification a marcher:
 echo("Date prolongée");
 
echo '<center><strong><a href=?numlien=spare> Retour </a></strong></center>';
 
//fermeture de la connexion
mysql_close();
 
 
?>
 
</body>
</html>