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 :

Dés envoi d'un formulaire, actualiser la page - possible ?


Sujet :

JavaScript

  1. #1
    Membre régulier Avatar de bilou95
    Inscrit en
    Septembre 2006
    Messages
    433
    Détails du profil
    Informations forums :
    Inscription : Septembre 2006
    Messages : 433
    Points : 117
    Points
    117
    Par défaut Dés envoi d'un formulaire, actualiser la page - possible ?
    Connaissez vous une facon d'actualisation automatiquement une page dés "submit" d'un formulaire ?

    Merci les amis !

  2. #2
    Expert éminent sénior

    Homme Profil pro
    Inscrit en
    Janvier 2007
    Messages
    13 474
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Secteur : Finance

    Informations forums :
    Inscription : Janvier 2007
    Messages : 13 474
    Points : 36 571
    Points
    36 571
    Par défaut
    Est-ce vraiment nécessaire ?
    Lors d'un submit, la page appelée (dans l'action du form) remplace celle affichée ...

    Pour tout savoir sur l'utilisation du forum

    En postant votre message, n'oubliez pas les Règles du Club.

  3. #3
    Membre régulier Avatar de bilou95
    Inscrit en
    Septembre 2006
    Messages
    433
    Détails du profil
    Informations forums :
    Inscription : Septembre 2006
    Messages : 433
    Points : 117
    Points
    117
    Par défaut
    non ... car je modifie des champs INPUT ... il me met pas les champs recemment mis a jour ...

  4. #4
    Expert éminent sénior

    Homme Profil pro
    Inscrit en
    Janvier 2007
    Messages
    13 474
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Secteur : Finance

    Informations forums :
    Inscription : Janvier 2007
    Messages : 13 474
    Points : 36 571
    Points
    36 571
    Par défaut
    Citation Envoyé par bilou95
    non ... car je modifie des champs INPUT
    Avant ou après le submit() ?
    ... il me met pas les champs recemment mis a jour ...
    Il te les met pas où ça ?
    Pour tout savoir sur l'utilisation du forum

    En postant votre message, n'oubliez pas les Règles du Club.

  5. #5
    Expert éminent sénior

    Homme Profil pro
    Inscrit en
    Janvier 2007
    Messages
    13 474
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Secteur : Finance

    Informations forums :
    Inscription : Janvier 2007
    Messages : 13 474
    Points : 36 571
    Points
    36 571
    Par défaut
    Mais j'y pense : y a une discussion récente, là-dessus.
    Tu devrais aller voir
    Pour tout savoir sur l'utilisation du forum

    En postant votre message, n'oubliez pas les Règles du Club.

  6. #6
    Membre régulier Avatar de bilou95
    Inscrit en
    Septembre 2006
    Messages
    433
    Détails du profil
    Informations forums :
    Inscription : Septembre 2006
    Messages : 433
    Points : 117
    Points
    117
    Par défaut


    Je sais !!!!!

    Ca m'enerve ce soucis ... j'ai changé tout mon code ... et ca fait exactement la meme chose ... en fait, c'est la fonction refresh() qui me fait CHIER

    Dés que je l'a retire, la mise a jour sur ma table SQL se passe bien sauf que dés que le "submit" est fait, la page ne s'actualise pas !!!!!!! correctement ...

    GRGRGRGRGRGRGRRG JE VAIS PETER UN PLOMB !!!!!!

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     
    function refresh()
    {
    window.location.reload();
    }

  7. #7
    Membre régulier Avatar de bilou95
    Inscrit en
    Septembre 2006
    Messages
    433
    Détails du profil
    Informations forums :
    Inscription : Septembre 2006
    Messages : 433
    Points : 117
    Points
    117
    Par défaut
    Re-Bonjour,

    J'ai tenté cette syntaxe :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     
    function refresh()
    {
    window.setTimeout(document.forms.maj_fiche.submit(),1000);
    }
    L'envoi se passe bien mais le refresh ne se fait pas au bout de 1 seconde ?????

    Pourquoi ??????

  8. #8
    Modérateur
    Avatar de Bisûnûrs
    Profil pro
    Développeur Web
    Inscrit en
    Janvier 2004
    Messages
    9 868
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Janvier 2004
    Messages : 9 868
    Points : 16 258
    Points
    16 258
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    function refresh()
    {
       setTimeout(function(){document.forms["maj_fiche"].submit();},1000);
    }

  9. #9
    Membre régulier Avatar de bilou95
    Inscrit en
    Septembre 2006
    Messages
    433
    Détails du profil
    Informations forums :
    Inscription : Septembre 2006
    Messages : 433
    Points : 117
    Points
    117
    Par défaut
    Et comment indiquerais tu un double rafraichissement ...

    Ce que je voudrais c par exemple un message indiquant a l'utilisateur que la modification est en cours ... et hop dés rafraichissement ca affiche les données mises a jour ...

    Vois tu ?

    Ton code précédemment marche parfaitement ... mais ce que je voudrais c que premierement le formulaire soit envoyé et apres un rafraichissement ...

    J'ai essayé par 2 fonctions dans un "onclick" mais ca marche une fois sur 3 ... je comprends pas pourquoi ?

  10. #10
    Modérateur
    Avatar de Bisûnûrs
    Profil pro
    Développeur Web
    Inscrit en
    Janvier 2004
    Messages
    9 868
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Janvier 2004
    Messages : 9 868
    Points : 16 258
    Points
    16 258
    Par défaut
    Quelles sont les données qui ne s'actualisent pas ?

    A priori, si tu renvoies le formulaire sur la même page, que tu fais le traitement des données tout en haut, donc avant la requête de récupération des données pour l'affichage des infos dans le formulaire, les données seront mises à jour ...

  11. #11
    Membre régulier Avatar de bilou95
    Inscrit en
    Septembre 2006
    Messages
    433
    Détails du profil
    Informations forums :
    Inscription : Septembre 2006
    Messages : 433
    Points : 117
    Points
    117
    Par défaut
    Veux tu que je te mette le code ?

  12. #12
    Modérateur
    Avatar de Bisûnûrs
    Profil pro
    Développeur Web
    Inscrit en
    Janvier 2004
    Messages
    9 868
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Janvier 2004
    Messages : 9 868
    Points : 16 258
    Points
    16 258
    Par défaut
    J'allais te le proposer.

  13. #13
    Membre régulier Avatar de bilou95
    Inscrit en
    Septembre 2006
    Messages
    433
    Détails du profil
    Informations forums :
    Inscription : Septembre 2006
    Messages : 433
    Points : 117
    Points
    117
    Par défaut
    Code php : 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
    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
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    <?php /* Date de création: 25/10/2006 */ ?>
    <html>
    <META NAME="Cache-Control" CONTENT="no-cache">
    <META NAME="pragma" CONTENT="no-cache">
    <head>
    <style>
    .largeur{width:20%}
    .largeur2{width:80%}
    </style> 
     
    </head>
    <body>
    <?php
    require("cnx/login_sql.php");
    //require("fonctions.php");
     
    //Connexion à la base de données
    $db = mysql_connect('localhost', 'root', '') or die ("Erreur de connexion");
     
    //Selection de la base
    mysql_select_db('alliance',$db);
     
    //Recupération de la variable id
    $id=$_GET['id'];
     
    //Selection de la table 'spare'
     
    $req_pr="SELECT * FROM spare WHERE id_spare='$id'";
     
    $sql_pr=mysql_query($req_pr) or die ('Erreur SQL !<br>'.$req.'<br>'.mysql_error());
     
    echo '<IMG src="image/fiche_sp.png" align="left" border=0>';
     
    while($data=mysql_fetch_assoc($sql_pr))
    	{
     
    echo '<DIV align="left"><strong><u><font face="verdana" size="3">'.$data['nom_spare'].'</font></u></strong></br></br>';
    echo'<table border="1">';
    echo'<tr>';	
     	if($data['modele'] == "ACER")
    	{
    	echo '<table style="border-color:#000000;border-width:1;border-style:dotted">';
    	echo '<tr>';
    	echo '<td align="center">';
    	echo '<IMG src="image/logo-acer.png" border=0>';
    	echo '</td>';
    	echo '<td>';
    	echo '<a href="http://support.acer-euro.com/">Support [www]</a>';
    	echo '</td>';
    	echo '</tr>';
    	echo '</table>';
    	}
    	elseif($data['modele'] == "DELL")
    	{
    	echo '<table style="border-color:#000000;border-width:1;border-style:dotted">';
    	echo '<tr>';
    	echo '<td align="center">';
    	echo '<IMG src="image/logo-dell.png" border=0>';
    	echo '</td>';
    	echo '<td>';
    	echo '<a href="http://support.euro.dell.com/">Support [www]</a>';
    	echo '</td>';
    	echo '</tr>';
    	echo '</table>';
    	}
    	elseif($data['modele'] == "NEC")
    	{
    	echo '<table style="border-color:#000000;border-width:1;border-style:dotted">';
    	echo '<tr>';
    	echo '<td align="center">';
    	echo '<IMG src="image/logo-nec.png" border=0>';
    	echo '</td>';
    	echo '<td>';
    	echo '<a href=" http://www.nec-display-solutions.fr/">Support [www]</a>';
    	echo '</td>';
    	echo '</tr>';
    	echo '</table>';
     
    	}
    echo'</tr>';
    echo '</table>';
     
     
    $recup_sp = $data['nom_spare'];
     
    $sp ="SELECT * FROM pr_spare INNER JOIN spare ON pr_spare.nomspare=spare.nom_spare WHERE pr_spare.nomspare='$recup_sp' AND pr_spare.emprunt=1";
    $exe_sp = mysql_query ($sp) or die ('Erreur SQL !<br>'.mysql_error());
     
    while($data_sp = mysql_fetch_assoc($exe_sp))
    {
    echo'<center><table style="border-color:#000000;border-width:1;border-style:dotted;background:#FCFCD8">';
    echo'<tr>';
    echo'<center><td><IMG src="image/information.png" style="border:"0""></td><td><font size="2">Pc Portable actuellement emprunté par <strong><u>'.$data_sp['emprunteur'].'</u></strong>, retour du matériel prévu pour le <strong><u>'.$dat_fr = convert_date($data_sp['Date_ret']).'</u></strong></font></td>';
    echo'</table>';
    echo'</tr>';
    }	
     
     
     
    	if($_SESSION['USER_GROUP'] == '2')
    {
    	echo'</br>';
    	echo'</br>';
    	echo '<table border=1 align=center width="80%">';
    	echo '<tr>';
    	echo '<td style="background-image:url(image/bg6box.gif)">Information Matériel</td>';
    	echo '</tr>';
    	echo '</table>';
    	echo '&nbsp';
    	echo '<table style="border-color:#000000;border-width:1;border-style:dashed" width="80%" align=center>';
    	echo '<tr>';
    	echo '<td class="largeur" style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">Modèle</td>';
     
    //1 - affichage fonction javascript permettant d'afficher un champ text et une image de validation dynamiquement 
     
    		echo '<script type="text/javascript">	
    function refresh()
    {
    setTimeout(function(){document.forms["maj_fiche"].submit();},3000);
    }
    
    function submit()
    {
    document.forms.maj_fiche.submit();
    
    }
    
    </script>';
     
    		echo '<script type="text/javascript">
         function afficher0()
         {
         document.getElementById("iddelinput0").style.visibility="visible";
    	 document.getElementById("iddelinput0").value="'.$data['modele'].'"
    	 document.getElementById("iddelimgannul0").style.visibility="visible";
    	 document.getElementById("iddelinput0").disabled = false;
         }
         </script>';
     
    	  echo '<script type="text/javascript">
         function annuler0()
         {
         document.getElementById("iddelimgannul0").style.visibility="hidden";
         }
         </script>';
     
    	 echo '<script type="text/javascript">
         function afficher1()
         {
         document.getElementById("iddelinput1").style.visibility="visible";
    	 document.getElementById("iddelinput1").value="'.$data['num_serie'].'"
    	 document.getElementById("iddelimgannul1").style.visibility="visible";
    	 document.getElementById("iddelinput1").disabled = false;
         }
         </script>';
     
    	 echo '<script type="text/javascript">
         function annuler1()
         {
         document.getElementById("iddelimgannul1").style.visibility="hidden";
         }
         </script>';
     
    	 echo '<script type="text/javascript">
         function afficher2()
         {
         document.getElementById("iddelinput2").style.visibility="visible";
    	 document.getElementById("iddelinput2").value="'.$data['num_inv'].'"
    	 document.getElementById("iddelimgannul2").style.visibility="visible";
    	 document.getElementById("iddelinput2").disabled = false;
         }
         </script>';
     
    	  echo '<script type="text/javascript">
         function annuler2()
         {
         document.getElementById("iddelimgannul2").style.visibility="hidden";
         }
         </script>';
    	 echo '<script type="text/javascript">
         function afficher3()
         {
         document.getElementById("iddelinput3").style.visibility="visible";
    	 document.getElementById("iddelinput3").value="'.$data['os'].'"
    	 document.getElementById("iddelimgannul3").style.visibility="visible";
    	 document.getElementById("iddelinput3").disabled = false;
         }
         </script>';
     
    	  echo '<script type="text/javascript">
         function annuler3()
         {
         document.getElementById("iddelimgannul3").style.visibility="hidden";
         }
         </script>';
     
    	 echo '<script type="text/javascript">
         function afficher4()
         {
         document.getElementById("iddelinput4").style.visibility="visible";
    	 document.getElementById("iddelinput4").value="'.$data['ram'].'"
    	 document.getElementById("iddelimgannul4").style.visibility="visible";
    	 document.getElementById("iddelinput4").disabled = false;
         }
         </script>';
     
    	  echo '<script type="text/javascript">
         function annuler4()
         {
         document.getElementById("iddelimgannul4").style.visibility="hidden";
         }
         </script>';
     
    	 echo '<script type="text/javascript">
         function afficher5()
         {
         document.getElementById("iddelinput5").style.visibility="visible";
    	 document.getElementById("iddelinput5").value="'.$data['hd'].'"
    	 document.getElementById("iddelimgannul5").style.visibility="visible";
    	 document.getElementById("iddelinput5").disabled = false;
         }
         </script>';
     
    	  echo '<script type="text/javascript">
         function annuler5()
         {
         document.getElementById("iddelimgannul5").style.visibility="hidden";
         }
         </script>';
     
    	  echo '<script type="text/javascript">
         function afficher6()
         {
         document.getElementById("iddelinput6").style.visibility="visible";
    	 document.getElementById("iddelinput6").value="'.$data['processeur'].'"
    	 document.getElementById("iddelimgannul6").style.visibility="visible";
    	 document.getElementById("iddelinput6").disabled = false;
         }
         </script>';
     
    	  echo '<script type="text/javascript">
         function annuler6()
         {
         document.getElementById("iddelimgannul6").style.visibility="hidden";
         }
         </script>';
     
    	 echo '<script type="text/javascript">
         function afficher7()
         {
         document.getElementById("iddelinput7").style.visibility="visible";
    	 document.getElementById("iddelinput7").value="'.$data['video'].'"
    	 document.getElementById("iddelimgannul7").style.visibility="visible";
    	 document.getElementById("iddelinput7").disabled = false;
         }
         </script>';
     
    	  echo '<script type="text/javascript">
         function annuler7()
         {
         document.getElementById("iddelimgannul7").style.visibility="hidden";
         }
         </script>';
     
    	 echo '<script type="text/javascript">
         function afficher8()
         {
         document.getElementById("iddelinput8").style.visibility="visible";
    	 document.getElementById("iddelinput8").value="'.$data['wifi'].'"
    	 document.getElementById("iddelimgannul8").style.visibility="visible";
    	 document.getElementById("iddelinput8").disabled = false;
         }
         </script>';
     
    	  echo '<script type="text/javascript">
         function annuler8()
         {
         document.getElementById("iddelimgannul8").style.visibility="hidden";
         }
         </script>';
     
    	 echo '<script type="text/javascript">
         function afficher9()
         {
         document.getElementById("iddelinput9").style.visibility="visible";
    	 document.getElementById("iddelinput9").value="'.$data['lan'].'"
    	 document.getElementById("iddelimgannul9").style.visibility="visible";
    	 document.getElementById("iddelinput9").disabled = false;
         }
         </script>';
     
    	  echo '<script type="text/javascript">
         function annuler9()
         {
         document.getElementById("iddelimgannul9").style.visibility="hidden";
         }
         </script>';
     
    echo '<form name="maj_fiche" method="POST" Action="index.php?numlien=fich_spare&id='.$id.'">';
     
    	if(isset($_POST["modele"])) {
    	$sql_modele="UPDATE spare SET modele='".$_POST["modele"]."' WHERE id_spare='$id'";
    	$exe_sqlmodele = mysql_query($sql_modele) or die('Erreur SQL !');
    						}	 
    	echo''; 
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">'.$data['modele'].'<IMG src="image/edit.png" id="iddelimage0" onclick="afficher0()"><input type="text" disabled="disabled" name="modele" id="iddelinput0" style="visibility: hidden" value=""><a href="#" onclick="annuler0();refresh();"><IMG src="image/annuler.jpg" id="iddelimgannul0" style="visibility: hidden" style="border:"0"></a></td>';	
        echo'</tr>';
     
    	echo'</tr>';
    	echo '<tr>';
    	echo '<td class="largeur" style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">N° série Machine</td>';
     
     
    	if(isset($_POST["numserie"])) {
    	$sql_numserie="UPDATE spare SET num_serie='".$_POST["numserie"]."' WHERE id_spare='$id'";
    	$exe_sqlnumserie = mysql_query($sql_numserie) or die('Erreur SQL !');
    								}
    	echo'';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">'.$data['num_serie'].'<IMG src="image/edit.png" id="iddelimage1" onclick="afficher1()"><input type="text" disabled="disabled" name="numserie" id="iddelinput1" style="visibility: hidden" value=""><a href="#" onclick="annuler1();refresh();"><IMG src="image/annuler.jpg" id="iddelimgannul1" style="visibility: hidden" style="border:"0"></a></td>';
     
    	echo'</tr>';
    	echo '<tr>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">N° Inventaire [A.H]</td>';
     
     
    	if(isset($_POST["numinv"])) {
    	$sql_numinv="UPDATE spare SET num_inv='".$_POST["numinv"]."' WHERE id_spare='$id'";
    	$exe_sqlnuminv = mysql_query($sql_numinv) or die('Erreur SQL !');
    								}
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">'.$data['num_inv'].'<IMG src="image/edit.png" id="iddelimage2" onclick="afficher2()"><input type="text" disabled="disabled"name="numinv" id="iddelinput2" style="visibility: hidden" value=""><a href="#" onclick="annuler2();refresh();"><IMG src="image/annuler.jpg" id="iddelimgannul2" style="visibility: hidden" style="border:"0"></a></td>';
     
     
    	echo'</tr>';
     
    	if($data['os'] == '') 
    	{
    	echo '<tr>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">Système d\'exploitation</td>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">';
    	if (isset($_POST["os"])) {
    	$sql_os="UPDATE spare SET os='".$_POST["os"]."' WHERE id_spare='$id'";
    	$exe_sqlos = mysql_query($sql_os) or die('Erreur SQL !');
    						}
    	echo '<input type="text" name="os" value="">';
    	echo '</td>';
    	}					
    		else
    	{
    	echo '<tr>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">Système d\'exploitation</td>';
     
    	if(isset($_POST["sys"])) {
    	$sql_sys="UPDATE spare SET os='".$_POST["sys"]."' WHERE id_spare='$id'";
    	$exe_sqlsys = mysql_query($sql_sys) or die('Erreur SQL !');
    								}
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">'.$data['os'].'<IMG src="image/edit.png" id="iddelimage3" onclick="afficher3()"><input type="text" disabled="disabled" name="sys" id="iddelinput3" style="visibility: hidden" value=""><a href="#" onclick="annuler3();refresh();"><IMG src="image/annuler.jpg" id="iddelimgannul3" style="visibility: hidden" style="border:"0"></a></td>';
    	echo'</tr>';
    	}
     
    	if($data['ram'] == '') 
    	{
    	echo '<tr>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">Mémoire vive [R.A.M]</td>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">'; 
     
    	if (isset($_POST["ram"])) {
    	$sql_ram="UPDATE spare SET ram='".$_POST["ram"]."' WHERE id_spare='$id'";
    	$exe_sqlram = mysql_query($sql_ram) or die('Erreur SQL !');
    						}
     
    	echo '<input type="text" name="ram" value="">';
    	echo'</td>';
    	}					
    		else
    	{
    	echo '<tr>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">Mémoire vive [R.A.M]</td>';
     
    	if(isset($_POST["mem"])) {
    	$sql_mem="UPDATE spare SET ram='".$_POST["mem"]."' WHERE id_spare='$id'";
    	$exe_sqlmem = mysql_query($sql_mem) or die('Erreur SQL !');
    								}
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">'.$data['ram'].'<IMG src="image/edit.png" id="iddelimage4" onclick="afficher4()"><input type="text" disabled="disabled" name="mem" id="iddelinput4" style="visibility: hidden" value=""><a href="#" onclick="annuler4();refresh();"><IMG src="image/annuler.jpg" id="iddelimgannul4" style="visibility: hidden" style="border:"0"></a></td>';
    	echo'</tr>';
    	}
     
    	if($data['hd'] == '')
    	{				
    	echo '<tr>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">Disque Dur [H.D]</td>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">'; 
     
    	if (isset($_POST["hd"])) {
    	$sql_hd="UPDATE spare SET hd='".$_POST["hd"]."' WHERE id_spare='$id'";
    	$exe_sqlhd = mysql_query($sql_hd) or die('Erreur SQL !');
    							 }
    	echo '<input type="text" name="hd" value="">';
    	echo'</td>';
    	}					
    		else
    	{
    	echo '<tr>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">Disque Dur [H.D]</td>';
     
    	if(isset($_POST["disk"])) {
    	$sql_disk="UPDATE spare SET hd='".$_POST["disk"]."' WHERE id_spare='$id'";
    	$exe_sqldisk = mysql_query($sql_disk) or die('Erreur SQL !');
    								}
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">'.$data['hd'].'<IMG src="image/edit.png" id="iddelimage5" onclick="afficher5()"><input type="text" disabled="disabled" name="disk" id="iddelinput5" style="visibility: hidden" value=""><a href="#" onclick="annuler5();refresh();"><IMG src="image/annuler.jpg" id="iddelimgannul5" style="visibility: hidden" style="border:"0"></a></td>';
    	echo'</tr>';
    	}
     
    	if($data['processeur'] == '')
    	{	
    	echo '<tr>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">Processeur</td>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">';
     
    	if (isset($_POST["processeur"])) {
    	$sql_proc="UPDATE spare SET processeur='".$_POST["processeur"]."' WHERE id_spare='$id'";
    	$exe_sqlproc = mysql_query($sql_proc) or die('Erreur SQL !');
    							 }
    	echo '<input type="text" name="processeur" value="">';
    	echo'</td>';
    	}					
    		else
    	{
    	echo '<tr>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">Processeur</td>';
     
    	if(isset($_POST["proc"])) {
    	$sql_proc="UPDATE spare SET processeur='".$_POST["proc"]."' WHERE id_spare='$id'";
    	$exe_sqlproc = mysql_query($sql_proc) or die('Erreur SQL !');
    								}
    	echo'';
     
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">'.$data['processeur'].'<IMG src="image/edit.png" id="iddelimage6" onclick="afficher6()"><input type="text" disabled="disabled" name="proc" id="iddelinput6" style="visibility: hidden" value=""><a href="#" onclick="annuler6();refresh();"><IMG src="image/annuler.jpg" id="iddelimgannul6" style="visibility: hidden" style="border:"0"></a></td>';
    	echo'</tr>';
    	}
     
    	if($data['video'] == '')
    	{	
    	echo '<tr>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">Vidéo [Carte graphique]</td>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">';
     
    	if (isset($_POST["video"])) {
    	$sql_vid="UPDATE spare SET video='".$_POST["video"]."' WHERE id_spare='$id'";
    	$exe_sqlvid = mysql_query($sql_vid) or die('Erreur SQL !');
    							 }
    	echo '<input type="text" name="video" value="">';
    	echo'</td>';
    	}					
    		else
    	{
    	echo '<tr>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">Vidéo [Carte graphique]</td>';
     
    	if(isset($_POST["vid"])) {
    	$sql_video="UPDATE spare SET video='".$_POST["vid"]."' WHERE id_spare='$id'";
    	$exe_sqlvideo = mysql_query($sql_video) or die('Erreur SQL !');
    								}
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">'.$data['video'].'<IMG src="image/edit.png" id="iddelimage7" onclick="afficher7()"><input type="text" disabled="disabled" name="vid" id="iddelinput7" style="visibility: hidden" value=""><a href="#" onclick="annuler7();refresh();"><IMG src="image/annuler.jpg" id="iddelimgannul7" style="visibility: hidden" style="border:"0"></a></td>';
    	echo'</tr>';
    	}
     
    	if($data['wifi'] == '')
    	{
    	echo '<tr>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">Sans Fil [Wifi]</td>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">';
     
    	if (isset($_POST["wifi"])) {
    	$sql_wifi="UPDATE spare SET wifi='".$_POST["wifi"]."' WHERE id_spare='$id'";
    	$exe_sqlwifi = mysql_query($sql_wifi) or die ('Erreur SQL ! <br>'.mysql_error());
    							 }
    	echo '<input type="text" name="wifi" value="">';
    	echo'</td>';
    	}					
    		else
    	{
    	echo '<tr>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">Sans Fil [Wifi]</td>';
     
    	if(isset($_POST["wii"])) {
    	$sql_wii="UPDATE spare SET wifi='".$_POST["wii"]."' WHERE id_spare='$id'";
    	$exe_sqlwii = mysql_query($sql_wii) or die ('Erreur SQL ! <br>'.mysql_error());
    								}	
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">'.$data['wifi'].'<IMG src="image/edit.png" id="iddelimage8" onclick="afficher8()"><input type="text" disabled="disabled" name="wii" id="iddelinput8" style="visibility: hidden" value=""><a href="#" onclick="annuler8();refresh();"><IMG src="image/annuler.jpg" id="iddelimgannul8" style="visibility: hidden" style="border:"0"></a></td>';
    	echo'</tr>';
    	}
     
    	if($data['lan'] == '')
    	{
    	echo '<tr>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">Carte réseau [LAN]</td>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">';
     
    	if (isset($_POST["lan"])) {
    	$sql_lan="UPDATE spare SET lan='".$_POST["lan"]."' WHERE id_spare='$id'";
    	$exe_sqllan = mysql_query($sql_lan) or die('Erreur SQL !');
    							 }
    	echo '<input type="text" name="lan" value="">';
    	echo'</td>';
    	}					
    		else
    	{
    	echo '<tr>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">Carte réseau [LAN]</td>';
     
    	if(isset($_POST["rj45"])) {
    	$sql_rj="UPDATE spare SET lan='".$_POST["rj45"]."' WHERE id_spare='$id'";
    	$exe_sqlrj = mysql_query($sql_rj) or die('Erreur SQL !');
    							}
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">'.$data['lan'].'<IMG src="image/edit.png" id="iddelimage9" onclick="afficher9()"><input type="text" disabled="disabled" name="rj45" id="iddelinput9" style="visibility: hidden" value=""><a href="#" onclick="annuler9();refresh();"><IMG src="image/annuler.jpg" id="iddelimgannul9" style="visibility: hidden" style="border:"0"></a></td>';
    	echo'</tr>';
    	}
     
    	echo'</tr>';
        echo '<center><a href="#" onclick="refresh();"><IMG src="image/valid.jpg" style="border:"0"></a></center>';
     
    	echo'</table>';
    	echo '</form>';
     
    }
    else
    {
     
        echo'</br>';
    	echo'</br>';
    	echo '<table border=1 align=center width="80%">';
    	echo '<tr>';
    	echo '<td style="background-image:url(image/bg6box.gif)">Information Matériel</td>';
    	echo '</tr>';
    	echo '</table>';
    	echo '&nbsp';
    	echo '<table style="border-color:#000000;border-width:1;border-style:dashed" width="80%" align=center>';
    	echo '<tr>';
    	echo '<td class="largeur" style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">Modèle</td>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">'.$data['modele'].'</td>';
    	echo'</tr>';
    	echo '<tr>';
    	echo '<td class="largeur" style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">N° série Machine</td>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">'.$data['num_serie'].'</td>';
    	echo'</tr>';
    	echo '<tr>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">N° Inventaire [A.H]</td>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">'.$data['num_inv'].'</td>';
    	echo'</tr>';
    	echo '<tr>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">Système Exploitation</td>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">'.$data['os'].'</td>';
    	echo'</tr>';
    	echo '<tr>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">Mémoire vive [R.A.M]</td>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">'.$data['ram'].'</td>';
    	echo'</tr>';
    	echo '<tr>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">Disque Dur [H.D]</td>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">'.$data['hd'].'</td>';
    	echo'</tr>';
    	echo '<tr>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">Processeur</td>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">'.$data['processeur'].'</td>';
    	echo'</tr>';
    	echo '<tr>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">Vidéo [Carte graphique]</td>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">'.$data['video'].'</td>';
    	echo'</tr>';
    	echo '<tr>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">Sans Fil [Wifi]</td>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">'.$data['wifi'].'</td>';
    	echo'</tr>';
    	echo '<tr>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted"><strong><font size="1">Carte réseau [LAN]</td>';
    	echo '<td style="border-color:#000000;border-width:1;border-style:dotted">'.$data['lan'].'</td>';
    	echo'</tr>';
    echo'</tr>';
    	echo'</table>';
    }
    echo '<center><strong><a href=?numlien=spare> Retour <font size="1">[Rubrique - Spare]</font></a></strong></center>';
    }	 
     
    mysql_close();
    ?>
    </body>
    </html>

  14. #14
    Modérateur
    Avatar de Bisûnûrs
    Profil pro
    Développeur Web
    Inscrit en
    Janvier 2004
    Messages
    9 868
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Janvier 2004
    Messages : 9 868
    Points : 16 258
    Points
    16 258
    Par défaut
    C'est bien ce que j'ai dit plus haut ...

    Tu fais un SELECT tout en haut de ta page :

    Code php : Sélectionner tout - Visualiser dans une fenêtre à part
    $req_pr="SELECT * FROM spare WHERE id_spare='$id'";

    Et les UPDATE beaucoup plus bas ...

    Donc au moment où tu fais ton SELECT pour afficher ton formulaire, il n'a pas encore modifié les données.

    Tu dois faire tes UPDATE avant ton SELECT.

  15. #15
    Membre régulier Avatar de bilou95
    Inscrit en
    Septembre 2006
    Messages
    433
    Détails du profil
    Informations forums :
    Inscription : Septembre 2006
    Messages : 433
    Points : 117
    Points
    117
    Par défaut
    Mais je ne peux pas déclarer les update avant mon SELECT ...

    Tout repose sur cette requete a la base ...

    Il doit bien y avoir une petite astuce !!!!

  16. #16
    Modérateur
    Avatar de Bisûnûrs
    Profil pro
    Développeur Web
    Inscrit en
    Janvier 2004
    Messages
    9 868
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Janvier 2004
    Messages : 9 868
    Points : 16 258
    Points
    16 258
    Par défaut
    Et pourtant quand je regarde tes requêtes :

    Code php : Sélectionner tout - Visualiser dans une fenêtre à part
    $sql_wii="UPDATE spare SET wifi='".$_POST["wii"]."' WHERE id_spare='$id'";

    A aucun endroit tu as besoin du résultat de ton SELECT, DONC, il faut que tu mettes ton UPDATE avant ton SELECT.

  17. #17
    Membre régulier Avatar de bilou95
    Inscrit en
    Septembre 2006
    Messages
    433
    Détails du profil
    Informations forums :
    Inscription : Septembre 2006
    Messages : 433
    Points : 117
    Points
    117
    Par défaut
    je peux pas faire ca ...

    y a pas un moyen en javascript ... de mettre une alerte pour indiquer "mise a jour en cours ..."

  18. #18
    Expert éminent sénior

    Homme Profil pro
    Inscrit en
    Janvier 2007
    Messages
    13 474
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Secteur : Finance

    Informations forums :
    Inscription : Janvier 2007
    Messages : 13 474
    Points : 36 571
    Points
    36 571
    Par défaut
    On en sait visiblement pas assez sur la logique (et chronologie) de ton traitement ...
    (parce que normallement, tu peux le faire )

    A+
    Pour tout savoir sur l'utilisation du forum

    En postant votre message, n'oubliez pas les Règles du Club.

  19. #19
    Membre régulier Avatar de bilou95
    Inscrit en
    Septembre 2006
    Messages
    433
    Détails du profil
    Informations forums :
    Inscription : Septembre 2006
    Messages : 433
    Points : 117
    Points
    117
    Par défaut
    Je me doute ...

    Mais je ne peux pas mettre les UPDATE avant le SELECT vu qu'il y a des variables $data qui repose sur une boucle WHILE qui elle repose sur le SELECT ...

    Ce qui me parait etrange c'est que les premiers champs se mettent correctement a jour mais les 3 ou 4 derniers champs refusent ...

  20. #20
    Expert éminent sénior

    Homme Profil pro
    Inscrit en
    Janvier 2007
    Messages
    13 474
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Secteur : Finance

    Informations forums :
    Inscription : Janvier 2007
    Messages : 13 474
    Points : 36 571
    Points
    36 571
    Par défaut
    Citation Envoyé par bilou95
    Mais je ne peux pas mettre les UPDATE avant le SELECT vu qu'il y a des variables $data qui repose sur une boucle WHILE qui elle repose sur le SELECT ...
    Ben dès le début tu stockes ton recordset dans un tableau pour ta boucle, et dans la table tu peux faire tes update quand tu veux ...
    Pour tout savoir sur l'utilisation du forum

    En postant votre message, n'oubliez pas les Règles du Club.

Discussions similaires

  1. [PHP 4] Actualiser page après l'envoi d'un formulaire
    Par Coolraoul dans le forum Langage
    Réponses: 2
    Dernier message: 17/05/2013, 11h43
  2. Réponses: 9
    Dernier message: 26/02/2009, 14h30
  3. Envois données formulaires vers deux pages php
    Par noxia dans le forum Langage
    Réponses: 3
    Dernier message: 24/11/2008, 11h59
  4. [CGI] Rester sur la page d'envoi d'un formulaire
    Par flykev dans le forum Langage
    Réponses: 2
    Dernier message: 28/07/2006, 14h21
  5. Envoi d'un formulaire vers 2 pages differentes
    Par BernardT dans le forum Langage
    Réponses: 2
    Dernier message: 14/11/2005, 00h35

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