IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JavaScript Discussion :

Action sur une liste déroulante


Sujet :

JavaScript

  1. #1
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Mai 2002
    Messages
    45
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2002
    Messages : 45
    Points : 31
    Points
    31
    Par défaut Action sur une liste déroulante
    Bonjour,
    J'ai une page EditClient ou je remplis une liste déroulante de mes clients via une base de données (jusque là pas de problèmes). J'aimerais ensuite remplir mes champs adresse,ville,tel etc... du client lorsque je selectionne mon client via ma liste.
    Je vous propose mon code ci-dessous :

    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
     
    <html>
    <body style="font: bold; font-size: x-small; font-weight: bold; font-family: Verdana; text-align: center" >
    <head></head>
     
    <STYLE TYPE="text/css">
    <!--
    INPUT {color: #CC0000; background-color: #FFCC00; font-size: 10px; font-family: verdana; border: none; font: bold}
    SELECT {color:#CC0000;background-color:#FFCC00;font-size:10px;font-family:verdana;}
    H1 {font-family: Verdana; font-size: x-small; font: bold}
    H2 {font-family: Verdana; font-size: x-small; font: bold; color: white}
    -->
    </style>
    <?php include ('menu.php'); ?>
    <? 
    		$link = mysql_connect("localhost", "root", "");
    		mysql_select_db("baseclients", $link) or die(mysql_error()); 
     
    		$req = "SELECT NOM FROM clients ORDER BY NOM";
    		$result = mysql_query($req);
     
    ?>
    <!-- Ici on a créé un tableau pour la banniere -->
    <table border="0" align="center" width="80%" height="15%" background="img/energybliss.jpg">
    	<tr>
    		<td></td> 
    	</tr>
    </table>
     
    <br><br><br><center>
    <!-- Ici on a créé un tableau pour la form Nouveau client -->
    <table border="0" align="center" width="65%">
    	<tr>
    	<td width="100%" align="left">
     
    		<table bgcolor="#336633" width="355" style="font-size: x-small" align="center">
    		  	<tr>
        		<td align="left"><h2>Edition d'un Client</td>
      			</tr>
    		</table><br>
     
    		<table border="0" align="center" cellspacing="0" bordercolor="#FFFFFF" style="background-color: #FFFF99; border: medium">
    			<tr>
    			<td><h1>Nom client :</td>
    			<td><select name="nom_client" id="nom_client">
    				<?
    				while ($oResult = mysql_fetch_object($result)) {	  
    					echo "<option value=\"$oResult->NOM\">$oResult->NOM</option> " ; }  
    					echo "<option value=\"Choisir un élément\" selected>Choisir un élément</option> " ;	
    				?>
    			</td></select>
    			</tr>		
    			<tr>
    			<td><h1>Adresse :</td>
    			<td><? echo"<input type='text' name='adresse_client' size='40' maxlength='256' value='toto'>";?></td>
    			</tr>
    			<tr>
    			<td><h1>Code Postal :</td>
    			<td><input type="text" name="cp_client" size="5" maxlength="256"></td>
    			</tr>
    			<tr>
    			<td><h1>Ville :</td>
    			<td><input type="text" name="ville_client" size="40" maxlength="256"></td>
    			</tr>
    			<tr>
    			<td><h1>Téléphone :</td>
    			<td><input type="text" name="tel_client" size="12" maxlength="256"></td>
    			</tr>
    			<tr>
    			<td><h1>Télécopie :</td>
    			<td><input type="text" name="fax_client" size="12" maxlength="256"></td>
    			</tr>
    			<tr>
    			<td><h1>Contact :</td>
    			<td><input type="text" name="contact_client" size="40" maxlength="256"></td>
    			</tr>
    			<tr>
    			<td><h1>E-mail :</td>
    			<td><input type="text" name="mail_client" size="40" maxlength="256"></td>
    			</tr>
     
    			<tr>
    			<td><h1>Famille :</td>
    			<td><input type="text" name="famille_client" size="40" maxlength="256"></td>
    			</tr>
     
    	</table>
    	<center>
    	<br><br>
    	<INPUT TYPE="submit" VALUE="Enregistrer" STYLE="color: #000000; background-color: #FF6600; font-size: 12px; font-family: arial; font-weight: bold; border-width: 1; width: 110px; text-align: center; border-color: black">
    	<INPUT TYPE="button" VALUE="Annuler" STYLE="color: #000000; background-color: #FF6600; font-size: 12px; font-family: arial; font-weight: bold; border-width: 1; width: 110px; text-align: center; border-color: black">
     
    		</td>
    	</tr>
    </table>
    </form>
    </html>
    Merci

  2. #2
    Membre expérimenté

    Profil pro
    Inscrit en
    Janvier 2005
    Messages
    1 278
    Détails du profil
    Informations personnelles :
    Localisation : France, Gironde (Aquitaine)

    Informations forums :
    Inscription : Janvier 2005
    Messages : 1 278
    Points : 1 639
    Points
    1 639
    Par défaut
    A priori, c'est du ressort d'AJAX. Va faire un tour dans les tutoriels javascript.

Discussions similaires

  1. Action sur une liste déroulante
    Par moustiq237 dans le forum IHM
    Réponses: 2
    Dernier message: 13/03/2013, 14h51
  2. [AJAX] Rafraîchissement automatique sur une liste déroulante
    Par frutix dans le forum Général JavaScript
    Réponses: 1
    Dernier message: 26/04/2007, 16h09
  3. Controle de saisie sur une liste déroulante
    Par antier dans le forum IHM
    Réponses: 3
    Dernier message: 07/12/2005, 05h42
  4. Réponses: 4
    Dernier message: 16/06/2005, 15h37

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo