salut a tous , voici le code de ma page 'corps_expedition',

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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
 
<script src="champsdyna1.js"></script>
<style type="text/css">
<!--
.Style6 {color: #000000; }
.Style7 {font-size: 10px}
.Style8 {font-size: 9px}
-->
</style>
 
<?php 
 
$db=mysql_connect ("localhost","root"); //Module de connexion
    mysql_select_db("gescour",$db);
?>
 
<script type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
 
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
 
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
 
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<body onLoad="MM_preloadImages('images/escale.JPG','images/livraison.JPG')"><div align="center"> 
  <p><a href="escale.php"></a><a href="escale.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('monsecale','','images/escale.JPG',1)"><img src="images/cup_coffee-48.png" name="monsecale" width="48" height="48" border="0" id="monsecale" /></a><a href="livraison.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('malivraison','','images/livraison.JPG',1)"><img src="images/air tickets.png" name="malivraison" width="56" height="54" border="0" id="malivraison" /></a></p>
  <p>EXPEDITION 
  </p>
<?php
  if( isset($_GET['msg']) )
    {
	  if ($_GET['msg']=0)
	    {
		  echo " ce numero de bordereaux est deja enregistré ";
		}
	  else
	    {
		  echo " l'expedition a ete bien enregistrée ";
		}
	} 
?> 
 
 
  <form method="post" action="expedition.php">
  <table width="682" border="0">
    <tr>
      <td width="714"><fieldset>
<legend> Details </legend>
<table width="661" border="0" cellspacing="0" cellpadding="5">
  <tr>
    <td width="117"><label></label></td>
    <td width="144"><div align="right">Nom de l'agence:</div></td>
    <td width="146"><select name="agence" id="agence">
        <?php 
	  $mesagences="SELECT * FROM agences"; //*****************selection des agences dans la base de données
	  $resultagence=mysql_query($mesagences) or die (mysql_error());
	  while($ligne=mysql_fetch_array ($resultagence)){ //listage des agences
  ?>
            <option><?php echo @$ligne['nom_agence']; ?></option>
            <?php } ?>
    </select></td>
    <td width="3" rowspan="2">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><div align="right">N° du Bordereau:</div></td>
    <td><label>
      <input name="nombord" type="text" id="nombord">
    </label></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td height="48"><label>
      <div align="right">Provenance:</div>
    </label></td>
    <td><label>
    <input name="provenance" type="text" id="provenance">
    </label></td>
    <td colspan="2"><label> 
      <div align="right">Destination:</div>
    </label></td>
    <td width="201"><label>
      <input name="destination" type="text" id="destination">
    </label></td>
  </tr>
</table>
<table width="662" border="0">
  <tr>
    <td colspan="2"><fieldset>
	<legend>Expéditeur</legend>
    <table width="267" border="0">
      <tr>
        <td width="92">Nom:</td>
        <td width="159"><label>
        <input name="nomexp" type="text" id="nomexp">
        </label></td>
      </tr>
      <tr>
        <td>Prenom(s):</td>
        <td><label>
          <input name="prenomexp" type="text" id="prenomexp">
        </label></td>
      </tr>
      <tr>
        <td>Ville:</td>
        <td><label>
        <input name="villexp" type="text" id="villexp">
        </label></td>
      </tr>
      <tr>
        <td>Pays:</td>
        <td><label>
          <select name="paysexp" id="paysexp" style="font-size:9px">
            <option></option>
            <?php 
	  $sql="SELECT * FROM pays"; //*****************selection des pays dans la base de données
	  $resultat=mysql_query($sql) or die (mysql_error());
	  while($row=mysql_fetch_array ($resultat)){ //listage des pays
  ?>
            <option><?php echo @$row['fr']; ?></option>
            <?php } ?>
           </select>
        </label></td>
      </tr>
      <tr>
        <td>Rue:</td>
        <td><label>
        <input name="ruexp" type="text" id="ruexp">
        </label></td>
      </tr>
      <tr>
        <td>T&eacute;l&eacute;phone:</td>
        <td><label>
        <input name="telephonexp" type="text" id="telephonexp">
        </label></td>
      </tr>
    </table>
    </fieldset>    </td>
    <td width="34">&nbsp;</td>
    <td width="395" colspan="2"><fieldset id="destinataire">
	<legend>Destinataire</legend>
	<table width="337" border="0">
      <tr>
        <td width="79">Noms:</td>
        <td width="258"><label>
        <input name="nomdes" type="text" id="nomdes">
        </label></td>
      </tr>
      <tr>
        <td>Pr&eacute;noms:</td>
        <td><label>
        <input name="prenomdes" type="text" id="prenomdes">
        </label></td>
      </tr>
      <tr>
        <td>Ville:</td>
        <td><label>
        <input name="villedes" type="text" id="villedes">
        </label></td>
      </tr>
      <tr>
        <td>Pays:</td>
        <td><label>
          <select name="paysdes" id="paysdes" style="font-size:9px">
            <option></option>
            <?php 
	  $sql="SELECT * FROM pays"; //*****************selection des pays dans la base de données
	  $resultat=mysql_query($sql) or die (mysql_error());
	  while($row=mysql_fetch_array ($resultat)){ //listage des pays
  ?>
            <option><?php echo @$row['fr']; ?></option>
            <?php } ?>
           </select>
        </label></td>
      </tr>
      <tr>
        <td>Rue:</td>
        <td><label>
        <input name="ruedes" type="text" id="ruedes">
        </label></td>
      </tr>
      <tr>
        <td>T&eacute;l&eacute;phone:</td>
        <td><label>
        <input name="telephonedes" type="text" id="telephonedes">
        </label></td>
      </tr>
    </table>
    </fieldset></td>
    </tr>
</table>
      </fieldset>
<p></p></td>
    </tr>
  </table>
 
<table width="760" border="0" cellspacing="0" cellpadding="5">
  <tr>
    <td colspan="3" valign="top"><fieldset id='fichiers' style="font-size:11px">
	 <legend> Details colis </legend>
	  <input type="button" name="Submit" value="+" onClick="ajouter()" />
	  <table width="459" height="28" border="0">
        <tr>
          <td width="140" bgcolor="#999999"><div align="center" class="Style6">Quantit&eacute;</div></td>
          <td width="151" bgcolor="#999999"><div align="center" class="Style6">D&eacute;signations</div></td>
          <td width="154" bgcolor="#999999"><div align="center" class="Style6">Poids</div></td>
        </tr>
      </table>
	  <br />
	  <table width="200" border="0"></table>
    </fieldset>                                      </td>
    </tr>
 
  <tr>
    <td width="0"></td>
    </tr>
</table>
 
<table width="717" border="0">
  <tr>
    <td width="757"><fieldset>
<legend>Details:</legend>
<table width="725" border="0" cellspacing="0" cellpadding="5">
  <tr>
    <td width="83" height="51"><label><span class="Style8">Statut:</span></label></td>
    <td width="472"><select name="statut" id="statut">
      <option value="&agrave; destination">&agrave; destination</option>
      <option value="en cour">en cours de traitement</option>
      <option value="livre">livr&eacute;</option>
    </select></td>
    <td width="158">
      <label><span class="Style7">Compteur</span>
 
      <input name="compteur" type="text" disabled="disabled" id="compteur" size="7"/>
      </label>
    </a></td>
  </tr>
</table>
</fieldset></td>
  </tr>
</table>
 
<br /><div align="center" ><input name="Envoyer" type="submit" value="Envoyer" />
<input type="reset" /></div>
 
<?php
// verifie si le numero de bordereau n'existe pas deja dans la base de données 
 
@$numbe=htmlentities ($_POST['nombord']);
$requette= " select * from bordereaux where num_be = '$numbe' " ;
$resultat=mysql_query($requette);
$lign=mysql_num_rows($resultat);
 
if ($lign > 0)
{
  header("Location:expedition.php?msg=0") ;
 //echo " il existe deja un bordereau à ce numero !!! " ;
}
else
{  
// insertion des donnees dans la base de donnees si le numero n'existe pas
 
  @$nomagence=htmlentities ($_POST['agence']);
  @$prove=htmlentities($_POST['provenance']);
  @$desti=htmlentities($_POST['destination']);
  @$nomexp=htmlentities($_POST['nomexp']);
  @$prenomexp=htmlentities($_POST['prenomexp']);
  @$paysexp=$_POST['paysexp'];
  @$villeexp=htmlentities($_POST['villexp']);
  @$rueexp=htmlentities($_POST['ruexp']);
  @$telexp=$_POST['telephonexp'];
  @$nomdest=htmlentities($_POST['nomdes']);
  @$prenomdest=htmlentities($_POST['prenomdes']);
  @$paysdest=htmlentities($_POST['paysdes']);
  @$villedest=htmlentities($_POST['villedes']);
  @$ruedest=htmlentities($_POST['ruedes']);
  @$teldest=htmlentities($_POST['telephonedes']);
  @$statut=$_POST['statut']; 
  @$dat=date("d-m-Y");
  @$heur=date("H:i");
 
     @$valeur=count($_POST['mesquantite']);
	 @$valeurdes=count($_POST['mesdesignation']);
 
	 for ($i=0;$i<$valeur;$i++)
	 {
	 //valeurs 
	  $quantite=array_values($_POST['mesquantite']);
	  $designation =array_values($_POST['mesdesignation']);
	  $poids=array_values($_POST['mespoids']);
	  @$produitfacture=mysql_query("INSERT INTO produits (num_prdt,num_be,designation,qute,poids) values ('','$numbe','$designation[$i]','$quantite[$i]','$poids[$i]')") or die (mysql_error());
	  //envoi dans la base de données
	   }
 $resultat2=mysql_query("INSERT INTO bordereaux(num_be,nom_agence,provenance,destination,statut_depart,date_depart,heure_depart,nom_exp, prenom_exp,pays_exp,ville_exp,rue_exp,tel_exp,nom_recep,prenom_recep,pays_recep,ville_recep,rue_recep,tel_recep) values ('$numbe','$nomagence','$prove','$desti','$statut','$dat','$heur','$nomexp','$prenomexp','$paysexp','$villeexp','$rueexp','$telexp','$nomdest','$prenomdest','$paysdest','$villedest','$ruedest','$teldest')") or die (mysql_error());// execute le requette
 
  header ("Location:expedition.php?msg=1");
//echo " l'enregistrement a été bien effectués " ;
}
?>
</form>
le but d'enregistrer une 'expedition' dans ma base de donnees et renvoyer en message selon que l'enregistrement a ete effectue ou pas, tous ceci en affichant la meme page.
pour cela je verifie d'abord si le numero de l'expedition n'existe pas deja pour eviter les doublons , s'il existe la mm page s'affiche mais cette fois avec un msg indiquant que le num existe , sinon l'enregistremnt s'affectue et la page s'affiche avec un msg indiquant que l'enregistrement a ete effectué.

sauf à l'execution j'ai ce message :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\wamp\www\gescour\corps_expedition.php:43) in C:\Program Files\wamp\www\gescour\corps_expedition.php on line 274
est un probleme avec la fonction 'header' vu que 'corps_expedition' ?
est qu'il y a un autre moyen pour atteindre mon objectif ?

merci d'avance de vos reponses.
cordialement.