Précédent   Forum des professionnels en informatique > PHP > PHP & SGBD
PHP & SGBD Forum d'entraide sur les SGBD avec PHP. Avant de poster : FAQ BDD, toutes les FAQ PHP, cours BDD et sources BDD
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 06/04/2008, 10h09   #1
Invité régulier
 
Inscription : mars 2005
Messages : 84
Détails du profil
Informations forums :
Inscription : mars 2005
Messages : 84
Points : 8
Points : 8
Par défaut "List/Menu" - Ordre alphabetique

Bonjour,
Je viens de créer un formulaire comportant plusieurs « list/menu » avec Dreamweaver 6 et sur une base MySql. Je voudrais savoir comment classer les éléments composants les éléments de réponse par ordre alphabétique et nom pas l’ordre dans lequel ils sont entres dans la table qui les fourni.

Par exemple pour le « list/menu » , suivant :
Code :
1
2
3
4
5
6
7
<td>Nom IDE de SSPI </td>
      <td><select name="nom_ide_sspi">
          <? while($val=mysql_fetch_array($result4)) {?>
          <option value="<? echo $val["lib_ide_sspi"];?>"><? echo $val["lib_ide_sspi"];?></option>
          <? }?>
        </select></td>
      <td>&nbsp;</td>
Quelqu’un aurait il une idée, un conseil, une remarque ? SVP – Merci
Raphaël

Voici le code du formulaire :
Code :
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
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
 
<? include 'scripts/connexion.php'; 
 
@$err=$_GET['err'];
 
@$err1=$_GET['err1'];
 
@$err2=$_GET['err2'];
 
@$err3=$_GET['err3'];
 
@$err4=$_GET['err4'];
 
@$err5=$_GET['err5'];
 
$req="select lib_discipline from discipline_chirurgicale ";
 
$result=mysql_query($req,$link);
 
 
 
$req="select lib_ansthesiste from nom_ansthesiste  ";
 
$result1=mysql_query($req,$link);
 
 
 
$req="select lib_nom_chir from nom_chirurgien  ";
 
$result2=mysql_query($req,$link);
 
 
 
$req="select lib_iade from nom_iade  ";
 
$result3=mysql_query($req,$link);
 
 
 
$req="select lib_ide_sspi from nom_ide_sspi  ";
 
$result4=mysql_query($req,$link);
 
 
 
$req="select * from intervention_menu";
 
$result5=mysql_query($req,$link);
 
 
 
@$val=$_POST['val'];
 
echo $val;
 
?>
 
 
 
<html xmlns="http://www.w3.org/1999/xhtml">
 
<head>
 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
 
<title>Untitled Document</title>
 
<link href="scripts/style.css" rel="stylesheet" type="text/css" />
 
<SCRIPT language=javascript>
 
//Ce petit script vous permet dappliquer un masque de saisie sur un champ de formulaire html.
 
//La fonction se présente comme suit :
 
function masqueSaisieDate(obj) {
 
 var ch;
 
 var ch_gauche, ch_droite;
 
 ch = obj.value;
 
 ch.toString(); 
 
 
 
 if ( ( (ch.slice(2,3)) != ("-") ) && (ch.length >= 3) ){
 
  ch_gauche = ch.slice(0,2);
 
  ch_droite = ch.slice(2);
 
  obj.value = ch_gauche + "-" + ch_droite;
 
 }
 
 if ( ( (ch.slice(5,6)) != ("-") ) && (ch.length >= 6) ){
 
  ch_gauche = ch.slice(0,5);
 
  ch_droite = ch.slice(5);
 
  obj.value = ch_gauche + "-" + ch_droite;
 
 }
 
  return;
 
}
 
//Pour l'appeler, il suffit de mettre quelque chose de ce style
 
 
 
//pour appeler la fonction. Il vous restera alors à taper quelque chose du style 12122001 qui sera automatiquement formaté en 12/12/2001
 
function PopupCentrer(page,largeur,hauteur,options) {
 
 
 
  var top=(screen.height-hauteur)/2;
 
 
 
  var left=(screen.width-largeur)/2;
 
 
 
  window.open(page,"","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
 
 
 
}
 
 
 
</SCRIPT>
 
 
 
</head>
 
 
 
<body bottommargin="0" topmargin="0" leftmargin="0" rightmargin="0">
 
<form method="post" name="formulaire" action="envoie_form.php">
 
<input type="hidden" name="mod_form" value="ajout">
 
  <table width="600" border="0" align="center" cellpadding="0" cellspacing="0" class="text_noir">
    <tr> 
      <td width="238">Nom</td>
      <td colspan="4"><input name="nom" type="text" class="zone" id="nom" /> <font color="#FF0000"> 
        <?=$err?>
        </font></td>
    </tr>
    <tr> 
      <td>Pr&eacute;nom</td>
      <td colspan="4"><input name="prenom" type="text" class="zone" id="prenom" /> 
        <font color="#FF0000"> 
        <?=$err1?>
        </font></td>
    </tr>
    <tr> 
      <td>Date de naissance </td>
      <td colspan="4"><input name="date_naiss" type="text" class="zone" id="date_naiss" onKeyUp="masqueSaisieDate(this.form.date_naiss)"/> 
        <font color="#FF0000"> 
        <?=$err2?>
        </font></td>
    </tr>
    <tr> 
      <td>N&deg;IPP</td>
      <td colspan="4"><input name="num_ipp" type="text" class="zone" id="num_ipp" /> 
        <font color="#FF0000"> 
        <?=$err3?>
        </font></td>
    </tr>
    <tr> 
      <td>Date de saisie </td>
      <td colspan="4"><input name="date_saisie" type="text" class="zone" id="date_saisie" onKeyUp="masqueSaisieDate(this.form.date_saisie)"/> 
        <font color="#FF0000"> 
        <?=$err4?>
        </font></td>
    </tr>
    <tr> 
      <td>Heure d'entr&eacute;e SSPI </td>
      <td colspan="4"><input name="h_entre" type="text" class="zone" id="h_entre" /></td>
    </tr>
    <tr> 
      <td>Heure de sortieSSPI</td>
      <td colspan="4"><input name="h_sortie" type="text" class="zone" id="h_sortie" /></td>
    </tr>
    <tr> 
      <td>Dur&eacute;e de s&eacute;jour </td>
      <td colspan="4"><input name="dure_sej" type="text" class="zone" id="dure_sej" /></td>
    </tr>
    <tr> 
      <td>Pr&eacute; ou Post Op&eacute;ratoire </td>
      <td colspan="2">Pré-op <input type="radio" name="pre_po" value="Pré Opératoire" /></td>
      <td colspan="2">Post-op 
        <input type="radio" name="pre_po" value="Post Opératoire" /></td>
    </tr>
    <tr> 
      <td>Num&eacute;ro du poste </td>
      <td colspan="4"><input name="num_poste" type="text" class="zone" id="num_poste" /></td>
    </tr>
    <tr> 
      <td>Nom IDE de SSPI </td>
      <td><select name="nom_ide_sspi">
          <? while($val=mysql_fetch_array($result4)) {?>
          <option value="<? echo $val["lib_ide_sspi"];?>"><? echo $val["lib_ide_sspi"];?></option>
          <? }?>
        </select></td>
      <td>&nbsp;</td>
      <td colspan="2"><a href='javascript:PopupCentrer("popup.php?table=nom_ide_sspi",200,110,"menubar=no,scrollbars=yes,statusbar=no")' class="det">+</a> 
        / <a href='javascript:PopupCentrer("popup2.php?table=nom_ide_sspi",200,110,"menubar=no,scrollbars=yes,statusbar=no")' class="det">-</a><font color="#FF0000"> 
        <?=$err5?>
        </font></td>
    </tr>
    <tr> 
      <td rowspan="2">Type Operation</td>
      <td rowspan="2"><select name="intervention_menu">
          <? while($val=mysql_fetch_array($result5)) {?>
          <option value="<? echo $val["menu"];?>"><? echo $val["menu"];?></option>
          <? }?>
        </select></td>
      <td rowspan="2"></td>
      <td width="152">Menu Intervention</td>
      <td width="76"><a href='javascript:PopupCentrer("popup.php?table=intervention_menu",200,110,"menubar=no,scrollbars=yes,statusbar=no")' class="det">+</a> 
        / <a href='javascript:PopupCentrer("popup2.php?table=intervention_menu",220,120,"menubar=no,scrollbars=yes,statusbar=no")' class="det">-</a></td>
    </tr>
    <tr> 
      <td>Sous Menu Intervention</td>
      <td><a href='javascript:PopupCentrer("popup1.php?table=intervention_sous_menu",200,110,"menubar=no,scrollbars=yes,statusbar=no")' class="det">+</a> 
        / <a href='javascript:PopupCentrer("popup2.php?table=intervention_sous_menu",220,120,"menubar=no,scrollbars=yes,statusbar=no")' class="det">-</a></td>
    </tr>
    <tr> 
      <td>Discipline Chirurgicale </td>
      <td width="122"><select name="disc_chir">
          <? while($val=mysql_fetch_array($result)) {?>
          <option value="<? echo $val["lib_discipline"];?>"><? echo $val["lib_discipline"];?></option>
          <? }?>
        </select></td>
      <td width="12"></td>
      <td colspan="2"><a href='javascript:PopupCentrer("popup.php?table=discipline_chirurgicale",200,110,"menubar=no,scrollbars=yes,statusbar=no")' class="det">+</a> 
        / <a href='javascript:PopupCentrer("popup2.php?table=discipline_chirurgicale",220,120,"menubar=no,scrollbars=yes,statusbar=no")' class="det">-</a></td>
    </tr>
    <tr> 
      <td>Nom Chirurgien </td>
      <td><select name="nom_chir">
          <? while($val=mysql_fetch_array($result2)) {?>
          <option value="<? echo $val["lib_nom_chir"];?>"><? echo $val["lib_nom_chir"];?></option>
          <? }?>
        </select></td>
      <td>&nbsp;</td>
      <td colspan="2"><a href='javascript:PopupCentrer("popup.php?table=nom_chirurgien",200,110,"menubar=no,scrollbars=yes,statusbar=no")' class="det">+</a> 
        / <a href='javascript:PopupCentrer("popup2.php?table=nom_chirurgien",200,110,"menubar=no,scrollbars=yes,statusbar=no")' class="det">-</a></td>
    </tr>
    <tr> 
      <td>Nom Anesth&eacute;siste </td>
      <td><select name="nom_anthes">
          <? while($val=mysql_fetch_array($result1)) {?>
          <option value="<? echo $val["lib_ansthesiste"];?>"><? echo $val["lib_ansthesiste"];?></option>
          <? }?>
        </select></td>
      <td>&nbsp;</td>
      <td colspan="2"><a href='javascript:PopupCentrer("popup.php?table=nom_ansthesiste",200,110,"menubar=no,scrollbars=yes,statusbar=no")' class="det">+</a> 
        / <a href='javascript:PopupCentrer("popup2.php?table=nom_ansthesiste",200,110,"menubar=no,scrollbars=yes,statusbar=no")' class="det">-</a> 
      </td>
    </tr>
    <tr> 
      <td>Nom IADE </td>
      <td><select name="nom_iade">
          <? while($val=mysql_fetch_array($result3)) {?>
          <option value="<? echo $val["lib_iade"];?>"><? echo $val["lib_iade"];?></option>
          <? }?>
        </select></td>
      <td>&nbsp;</td>
      <td colspan="2"><a href='javascript:PopupCentrer("popup.php?table=nom_iade",200,110,"menubar=no,scrollbars=yes,statusbar=no")' class="det">+</a> 
        / <a href='javascript:PopupCentrer("popup2.php?table=nom_iade",200,110,"menubar=no,scrollbars=yes,statusbar=no")' class="det">-</a> 
      </td>
    </tr>
    <tr> 
      <td>Ventil&eacute;</td>
      <td colspan="2">oui 
        <input type="radio" name="ventile" value="oui" /></td>
      <td colspan="2">non 
        <input type="radio" name="ventile" value="non" /></td>
    </tr>
    <tr> 
      <td>Si oui, dur&eacute;e </td>
      <td colspan="4"><input name="dure_ventil" type="text" class="zone" id="dure_ventil" /></td>
    </tr>
    <tr> 
      <td>PCA</td>
      <td colspan="2">oui 
        <input type="radio" name="pca" value="oui" /></td>
      <td colspan="2">non 
        <input type="radio" name="pca" value="non" /></td>
    </tr>
    <tr> 
      <td>Si oui, Num&eacute;ro de PCA </td>
      <td colspan="4"><input name="num_pca" type="text" class="zone" id="num_pca" /></td>
    </tr>
    <tr> 
      <td>Transfusion</td>
      <td colspan="2">oui 
        <input type="radio" name="transfusion" value="oui" /></td>
      <td colspan="2">non 
        <input type="radio" name="transfusion" value="non" /></td>
    </tr>
    <tr> 
      <td>Si oui, d&eacute;tail </td>
      <td colspan="4"><textarea name="transfusion_det" class="zone_adresse"></textarea></td>
    </tr>
    <tr> 
      <td>Remarque</td>
      <td colspan="4"><textarea name="remarque" class="zone_adresse"></textarea></td>
    </tr>
    <tr> 
      <td height="48"><div align="center"> 
          <input type="submit" class="ok" value="Envoyer" />
        </div></td>
      <td colspan="4"><div align="center"> 
          <input type="reset" class="ok" value="Effacer" />
        </div></td>
    </tr>
  </table>
 
<p><br>
  </p>
  <table class="text_noir"><tr>
 
  <td width="574"><a href="form.php" class="det">Ajouter un nouvel enregistrement  </a>&nbsp;&nbsp;| &nbsp;&nbsp;<a href="recherche.php" class="det">Recherche </a>&nbsp;&nbsp;| &nbsp;&nbsp;<a href="logout.php" class="det">D&eacute;connexion</a>&nbsp;&nbsp;| &nbsp;&nbsp;<a href="menu.php" class="det">Accueil</a></td>
 
</tr>
 
</table>
 
</form>
 
 
 
 
 
</body>
 
</html>
Raphael39 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 06/04/2008, 10h21   #2
Membre éclairé
 
Avatar de FredPsy
 
Homme Frédéric BERTHORELLY
Formateur en informatique
Inscription : décembre 2006
Messages : 270
Détails du profil
Informations personnelles :
Nom : Homme Frédéric BERTHORELLY
Âge : 35
Localisation : Djibouti

Informations professionnelles :
Activité : Formateur en informatique
Secteur : Administration - Collectivité locale

Informations forums :
Inscription : décembre 2006
Messages : 270
Points : 318
Points : 318
Bonjour,
Ajoutes des order by dans tes requêtes.

Exemple
Imagines une liste de nom dans une table Mysql, ça donne :
Code :
1
2
 
$requete = "select * from table_personne order by nom";
Tu auras un classement alphabétique.
Regardes la doc Mysql, tout y es.

Bonne journée
__________________
"Dites moi ce dont vous avez besoin, je vous apprendrai à vous en passer".
Et de grâce, je ne possède pas le plugin boule de cristal de firefox, alors soyez clair dans vos questions.

Je lutte contre le language SMS.
FredPsy est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 06/04/2008, 12h23   #3
Invité régulier
 
Inscription : mars 2005
Messages : 84
Détails du profil
Informations forums :
Inscription : mars 2005
Messages : 84
Points : 8
Points : 8
Par défaut Ordre alphabetique

Bonjour,

Merci pour cette reponse rapide. J'ai modifié mon code et cela marche.

Merci Raphael
Raphael39 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 19h07.


 
 
 
 
Partenaires

Hébergement Web