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

Langage PHP Discussion :

Problème : Script PHP IE NOK Firefox OK


Sujet :

Langage PHP

  1. #21
    Membre à l'essai
    Profil pro
    Inscrit en
    Novembre 2005
    Messages
    39
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2005
    Messages : 39
    Points : 15
    Points
    15
    Par défaut
    <div id="conteneur">
    <img src="deco_haut.gif" width="768" height="28" alt="deco_haut" />
    <div id="cadrep">
    <div class="gauche">
    <table>
    <tr><td class="cell_titre">
    <img src="icon_titre.gif" width="560" height="66" alt="Custom V1.0" />
    </td><td class="cell_icon_custom">
    <img src="icon_custom.gif" width="166" height="66" alt="Custom V1.0" />
    </td></tr>
    </table>
    <br /><br />
    <!-- Custom V1.0 Formulaire -->
    <form id="custom1.0" action="/Cle/W2DV2/custom/form.php" method="post">
    <p>
    <!-- Calculer le formulaire -->
    <input type="image" name="calcul" alt="Calculer" src="bouton_calcul.gif" value="ok" />
    <br /><br />
    </p>
    <!-- Affichage du total après un premier calcul -->
    <table><tr><td><img src="icon_euro.gif" width="20" height="20" alt="Total" /></td><td class="padding_cell"><span class="texte_bleu_gras">Total : 163.2 EUR</span> &nbsp; Votre commande peut être validée par W2D Custom.</td></tr></table>
    <p><br /> <!-- Choix 1 - Nombre de pages statiques -->
    Nombre de pages statiques avec vos textes et photos ( FAQ )<br />
    <input type="radio" name="choix1" value="1" checked="checked" /> 1 page<br />
    <input type="radio" name="choix1" value="2" /> 2 pages<br />
    <input type="radio" name="choix1" value="3" /> 3 à 5 pages<br />
    <input type="radio" name="choix1" value="4" /> 5 à 10 pages<br />
    <input type="radio" name="choix1" value="5" /> Plus<br /><br />
    <!-- Choix 2 - Page de contact -->
    Page de contact avec formulaire ( FAQ )<br />
    <input type="radio" name="choix2" value="1" checked="checked" /> Oui<br />
    <input type="radio" name="choix2" value="2" /> Non<br /><br />
    <!-- Choix 3 - Nom de domaine -->
    Nom de domaine pour 1 an ( FAQ )<br />
    <input type="radio" name="choix3" value="1" checked="checked" /> Domaine .com .net .org .info ou .biz<br />
    <input type="radio" name="choix3" value="2" /> Domaine .eu<br />
    <input type="radio" name="choix3" value="3" /> Domaine .fr<br />
    <input type="radio" name="choix3" value="4" /> Aucun<br /><br />
    <!-- Choix 4 - Hébergement -->
    Hébergement du site pour 1 an ( FAQ )<br />
    <input type="radio" name="choix4" value="1" checked="checked" /> 60 Mo / 1 Base de données / 5 comptes mail / Trafic 20 Go mensuels<br />
    <input type="radio" name="choix4" value="2" /> 300 Mo / 2 Bases de données / 8 comptes mail / Trafic 30 Go mensuels<br />
    <input type="radio" name="choix4" value="3" /> 720 Mo / 25 Bases de données / 1000 comptes mail / Trafic 120 Go mensuels<br />
    <input type="radio" name="choix4" value="4" /> Offre supérieure<br />
    <input type="radio" name="choix4" value="5" /> Aucun<br /><br />
    <!-- Choix 5 - Scripts dynamiques -->
    Nombre de scripts permettant la gestion dynamique d'articles ( FAQ )<br />
    <input type="radio" name="choix5" value="1" /> 1 script<br />
    <input type="radio" name="choix5" value="2" /> 2 scripts<br />
    <input type="radio" name="choix5" value="3" /> 3 scripts<br />
    <input type="radio" name="choix5" value="4" /> Plus de scripts dynamiques<br />
    <input type="radio" name="choix5" value="5" checked="checked" /> Aucun<br /><br />
    <!-- Choix 6 - Upload d'images -->
    Script d'upload d'images sur votre serveur ( FAQ )<br />
    <input type="radio" name="choix6" value="1" /> Oui<br />
    <input type="radio" name="choix6" value="2" checked="checked" /> Non<br /><br />
    <!-- Inclus -->
    Services inclus gratuitement<br />
    <input type="radio" name="inclus" value="1" checked="checked" /> Statistiques détaillées<br /><br />
    <!-- Calculer le formulaire -->
    <br />
    <input type="image" name="calcul" alt="Calculer" src="bouton_calcul.gif" value="ok" />
    </p>
    </form>
    <!-- Fin Formulaire -->
    <br /><br />
    </div>
    </div>
    <div id="deco_bas">
    <img src="deco_bas.gif" width="768" height="28" alt="deco_bas" />
    </div>
    <br />
    <br /><br />
    </div>

  2. #22
    Expert confirmé
    Avatar de siddh
    Inscrit en
    Novembre 2005
    Messages
    3 868
    Détails du profil
    Informations personnelles :
    Âge : 48

    Informations forums :
    Inscription : Novembre 2005
    Messages : 3 868
    Points : 5 011
    Points
    5 011
    Par défaut
    alors ce source me check les bons sous ie et ffx

  3. #23
    Membre à l'essai
    Profil pro
    Inscrit en
    Novembre 2005
    Messages
    39
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2005
    Messages : 39
    Points : 15
    Points
    15
    Par défaut
    Oui, mais ce sont les checked par défaut, il ne prend pas en compte ceux cochés par l'utilisateur avant la soumission du formulaire

  4. #24
    Expert confirmé
    Avatar de siddh
    Inscrit en
    Novembre 2005
    Messages
    3 868
    Détails du profil
    Informations personnelles :
    Âge : 48

    Informations forums :
    Inscription : Novembre 2005
    Messages : 3 868
    Points : 5 011
    Points
    5 011
    Par défaut
    t'as essayé ca ?

  5. #25
    Expert éminent Avatar de Mr N.
    Profil pro
    Inscrit en
    Septembre 2004
    Messages
    5 418
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2004
    Messages : 5 418
    Points : 6 449
    Points
    6 449
    Par défaut
    ce que tu as posté c'est suite à un changement d'option par l'utilisateur ? Parce que moi j'ai pas ça !

  6. #26
    Membre à l'essai
    Profil pro
    Inscrit en
    Novembre 2005
    Messages
    39
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2005
    Messages : 39
    Points : 15
    Points
    15
    Par défaut
    Citation Envoyé par Mr N.
    ce que tu as posté c'est suite à un changement d'option par l'utilisateur ? Parce que moi j'ai pas ça !
    Oui... sur IE

  7. #27
    Expert éminent Avatar de Mr N.
    Profil pro
    Inscrit en
    Septembre 2004
    Messages
    5 418
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2004
    Messages : 5 418
    Points : 6 449
    Points
    6 449
    Par défaut
    Tu as un exemple en ligne qu'on teste ?

  8. #28
    Membre à l'essai
    Profil pro
    Inscrit en
    Novembre 2005
    Messages
    39
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2005
    Messages : 39
    Points : 15
    Points
    15
    Par défaut
    Voilà :

    http://sd84.sivit.org/w2d_files/essai.php

  9. #29
    Expert confirmé
    Avatar de siddh
    Inscrit en
    Novembre 2005
    Messages
    3 868
    Détails du profil
    Informations personnelles :
    Âge : 48

    Informations forums :
    Inscription : Novembre 2005
    Messages : 3 868
    Points : 5 011
    Points
    5 011
    Par défaut
    Citation Envoyé par siddh
    t'as essayé ca ?

  10. #30
    Expert éminent Avatar de Mr N.
    Profil pro
    Inscrit en
    Septembre 2004
    Messages
    5 418
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2004
    Messages : 5 418
    Points : 6 449
    Points
    6 449
    Par défaut
    j'obtiens ceci dans le source de la page, après avoir coché une option différente de l'origine :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    					<input type="radio" name="choix1" value="1" checked="checked" /> 1 page<br />
    					<input type="radio" name="choix1" value="2"  /> 2 pages<br />
    					<input type="radio" name="choix1" value="3" checked="checked" /> 3 à 5 pages<br />
    					<input type="radio" name="choix1" value="4"  /> 5 à 10 pages<br />
     
    					<input type="radio" name="choix1" value="5"  /> Plus<br /><br />
    Vois-tu un problème ?

  11. #31
    Membre à l'essai
    Profil pro
    Inscrit en
    Novembre 2005
    Messages
    39
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2005
    Messages : 39
    Points : 15
    Points
    15
    Par défaut
    Citation Envoyé par siddh
    Citation Envoyé par siddh
    t'as essayé ca ?
    Désolé, oui, ça ne change rien !

  12. #32
    Membre à l'essai
    Profil pro
    Inscrit en
    Novembre 2005
    Messages
    39
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2005
    Messages : 39
    Points : 15
    Points
    15
    Par défaut
    Citation Envoyé par Mr N.
    j'obtiens ceci dans le source de la page, après avoir coché une option différente de l'origine :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    					<input type="radio" name="choix1" value="1" checked="checked" /> 1 page<br />
    					<input type="radio" name="choix1" value="2"  /> 2 pages<br />
    					<input type="radio" name="choix1" value="3" checked="checked" /> 3 à 5 pages<br />
    					<input type="radio" name="choix1" value="4"  /> 5 à 10 pages<br />
     
    					<input type="radio" name="choix1" value="5"  /> Plus<br /><br />
    Vois-tu un problème ?
    Oui... ça peut avoir aussi un rapport avec le total ?
    Je vais essayer de égler ça.

  13. #33
    Expert confirmé
    Avatar de siddh
    Inscrit en
    Novembre 2005
    Messages
    3 868
    Détails du profil
    Informations personnelles :
    Âge : 48

    Informations forums :
    Inscription : Novembre 2005
    Messages : 3 868
    Points : 5 011
    Points
    5 011
    Par défaut
    il faut que tu remettes ton choix1_1 a vide si c est pas lui qui est selectionné

  14. #34
    Membre à l'essai
    Profil pro
    Inscrit en
    Novembre 2005
    Messages
    39
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2005
    Messages : 39
    Points : 15
    Points
    15
    Par défaut
    Citation Envoyé par siddh
    il faut que tu remettes ton choix1_1 a vide si c est pas lui qui est selectionné
    Oui j'avais compris :p
    J'imagine que Firefox dans ce cas prend le dernier séléctionné, c'est pour ça que ça marche, mais IE doit prendre le premier, ce qui explique le total fixe... Je vais faire ça !

  15. #35
    Membre à l'essai
    Profil pro
    Inscrit en
    Novembre 2005
    Messages
    39
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2005
    Messages : 39
    Points : 15
    Points
    15
    Par défaut
    Ca n'a pas l'air de changer :

    http://sd84.sivit.org/w2d_files/essai.php

    Le checked est mis correctement a priori, en tout cas il n'y a plus d'erreur dans le code source, j'ai regardé plusieurs fois après avoir changé des options...

    Je redonne le PHP modifié :

    <?php
    // Création des variables pour conserver les cases cochées
    $choix1_1 = 'checked="checked"' ;
    $choix1_2 = "" ;
    $choix1_3 = "" ;
    $choix1_4 = "" ;
    $choix1_5 = "" ;
    $choix2_1 = 'checked="checked"' ;
    $choix2_2 = "" ;
    $choix3_1 = 'checked="checked"' ;
    $choix3_2 = "" ;
    $choix3_3 = "" ;
    $choix3_4 = "" ;
    $choix4_1 = 'checked="checked"' ;
    $choix4_2 = "" ;
    $choix4_3 = "" ;
    $choix4_4 = "" ;
    $choix4_5 = "" ;
    $choix5_1 = "" ;
    $choix5_2 = "" ;
    $choix5_3 = "" ;
    $choix5_4 = "" ;
    $choix5_5 = 'checked="checked"' ;
    $choix6_1 = "" ;
    $choix6_2 = 'checked="checked"' ;
    $avert = false ;
    $total = 0 ;
    // Test si le formulaire a été validé afin d'être recalculé
    if (isset($_POST["calcul"])) {
    // Choix 1 - Nombre d epages statiques
    $choix1 = $_POST["choix1"] ;
    if ($choix1 == "1") {
    $choix1_1 = 'checked="checked"' ;
    $choix1_2 = "" ;
    $choix1_3 = "" ;
    $choix1_4 = "" ;
    $choix1_5 = "" ;
    $total = $total + 39 ;
    }
    else if ($choix1 == "2") {
    $choix1_2 = 'checked="checked"' ;
    $choix1_1 = "" ;
    $choix1_3 = "" ;
    $choix1_4 = "" ;
    $choix1_5 = "" ;
    $total = $total + 69 ;
    }
    else if ($choix1 == "3") {
    $choix1_3 = 'checked="checked"' ;
    $choix1_1 = "" ;
    $choix1_2 = "" ;
    $choix1_4 = "" ;
    $choix1_5 = "" ;
    $total = $total + 179 ;
    }
    else if ($choix1 == "4") {
    $choix1_4 = 'checked="checked"' ;
    $choix1_1 = "" ;
    $choix1_2 = "" ;
    $choix1_3 = "" ;
    $choix1_5 = "" ;
    $total = $total + 379 ;
    }
    else if ($choix1 == "5") {
    $choix1_5 = 'checked="checked"' ;
    $choix1_1 = "" ;
    $choix1_2 = "" ;
    $choix1_3 = "" ;
    $choix1_4 = "" ;
    $avert = true ;
    }
    // Choix 2 - Page de contact
    $choix2 = $_POST["choix2"] ;
    if ($choix2 == "1") {
    $choix2_1 = 'checked="checked"' ;
    $choix2_2 = "" ;
    $total = $total + 49 ;
    }
    else if ($choix2 == "2") {
    $choix2_2 = 'checked="checked"' ;
    $choix2_1 = "" ;
    }
    // Choix 3 - Domaine
    $choix3 = $_POST["choix3"] ;
    if ($choix3 == "1") {
    $choix3_1 = 'checked="checked"' ;
    $choix3_2 = "" ;
    $choix3_3 = "" ;
    $choix3_4 = "" ;
    $total = $total + 19 ;
    }
    else if ($choix3 == "2") {
    $choix3_2 = 'checked="checked"' ;
    $choix3_1 = "" ;
    $choix3_3 = "" ;
    $choix3_4 = "" ;
    $total = $total + 24 ;
    }
    else if ($choix3 == "3") {
    $choix3_3 = 'checked="checked"' ;
    $choix3_1 = "" ;
    $choix3_2 = "" ;
    $choix3_4 = "" ;
    $total = $total + 34 ;
    }
    else if ($choix3 == "4") {
    $choix3_4 = 'checked="checked"' ;
    $choix3_1 = "" ;
    $choix3_2 = "" ;
    $choix3_3 = "" ;
    }
    // Choix 4 - Hébergement
    $choix4 = $_POST["choix4"] ;
    if ($choix4 == "1") {
    $choix4_1 = 'checked="checked"' ;
    $choix4_2 = "" ;
    $choix4_3 = "" ;
    $choix4_4 = "" ;
    $choix4_5 = "" ;
    $total = $total + 29 ;
    }
    else if ($choix4 == "2") {
    $choix4_2 = 'checked="checked"' ;
    $choix4_1 = "" ;
    $choix4_3 = "" ;
    $choix4_4 = "" ;
    $choix4_5 = "" ;
    $total = $total + 79 ;
    }
    else if ($choix4 == "3") {
    $choix4_3 = 'checked="checked"' ;
    $choix4_1 = "" ;
    $choix4_2 = "" ;
    $choix4_4 = "" ;
    $choix4_5 = "" ;
    $total = $total + 266 ;
    }
    else if ($choix4 == "4") {
    $choix4_4 = 'checked="checked"' ;
    $choix4_1 = "" ;
    $choix4_2 = "" ;
    $choix4_3 = "" ;
    $choix4_5 = "" ;
    $avert = true ;
    }
    else if ($choix4 == "5") {
    $choix4_5 = 'checked="checked"' ;
    $choix4_1 = "" ;
    $choix4_2 = "" ;
    $choix4_3 = "" ;
    $choix4_4 = "" ;
    }
    // Choix 5 - Scripts dynamiques
    $choix5 = $_POST["choix5"] ;
    if ($choix5 == "1") {
    $choix5_1 = 'checked="checked"' ;
    $choix5_2 = "" ;
    $choix5_3 = "" ;
    $choix5_4 = "" ;
    $choix5_5 = "" ;
    $total = $total + 56 ;
    }
    else if ($choix5 == "2") {
    $choix5_2 = 'checked="checked"' ;
    $choix5_1 = "" ;
    $choix5_3 = "" ;
    $choix5_4 = "" ;
    $choix5_5 = "" ;
    $total = $total + 109 ;
    }
    else if ($choix5 == "3") {
    $choix5_3 = 'checked="checked"' ;
    $choix5_1 = "" ;
    $choix5_2 = "" ;
    $choix5_4 = "" ;
    $choix5_5 = "" ;
    $total = $total + 159 ;
    }
    else if ($choix5 == "4") {
    $choix5_4 = 'checked="checked"' ;
    $choix5_1 = "" ;
    $choix5_2 = "" ;
    $choix5_3 = "" ;
    $choix5_5 = "" ;
    $avert = true ;
    }
    else if ($choix5 == "5") {
    $choix5_5 = 'checked="checked"' ;
    $choix5_1 = "" ;
    $choix5_2 = "" ;
    $choix5_3 = "" ;
    $choix5_4 = "" ;
    }
    // Choix 6 - Script d'upload
    $choix6 = $_POST["choix6"] ;
    if ($choix6 == "1") {
    $choix6_1 = 'checked="checked"' ;
    $choix6_2 = "" ;
    $total = $total + 29 ;
    }
    else if ($choix6 == "2") {
    $choix6_1 = "" ;
    $choix6_2 = 'checked="checked"' ;
    }
    // Mise en ligne, configuration : + 20%
    $total = $total + (($total * 20) / 100) ;
    }
    else if (!isset($_POST["calcul"]))
    $total = "163.2" ;
    ?>

  16. #36
    Expert éminent Avatar de Mr N.
    Profil pro
    Inscrit en
    Septembre 2004
    Messages
    5 418
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2004
    Messages : 5 418
    Points : 6 449
    Points
    6 449
    Par défaut
    tu peux faire un var_dump($_POST) au début de la page pour voir ?

  17. #37
    Membre à l'essai
    Profil pro
    Inscrit en
    Novembre 2005
    Messages
    39
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2005
    Messages : 39
    Points : 15
    Points
    15
    Par défaut
    C'est fait ( http://sd84.sivit.org/w2d_files/essai.php )

  18. #38
    Expert confirmé
    Avatar de siddh
    Inscrit en
    Novembre 2005
    Messages
    3 868
    Détails du profil
    Informations personnelles :
    Âge : 48

    Informations forums :
    Inscription : Novembre 2005
    Messages : 3 868
    Points : 5 011
    Points
    5 011
    Par défaut
    alors je sais ce qui clochais dans ton script, c est ton if isset qui n'es jamais vrai a cause de ton input image.

    J'ai un peu optimisé ton code pour le rendre plus générique et il marche.

    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
    <form id="custom1.0" action="<?php echo $_SERVER['PHP_SELF']."?docalc=true" ; ?>" method="post"> 
    <p> 
    <!-- Calculer le formulaire --> 
    <input type="image" name="calcul" alt="Calculer" src="bouton_calcul.gif" value="ok" /> 
    <br /><br /> 
    </p> 
    <!-- Affichage du total après un premier calcul --> 
    <?php 
    // Affichage du total après un premier calcul 
     
    $avert = false ; 
    $total = 0 ; 
     
    $choix = array(array('1 page','2 pages','3 à 5 pages','5 à 10 pages','Plus'),
    					array('Oui','Non'),
    					array('Domaine .com .net .org .info ou .biz','Domaine .eu','Domaine .fr','Aucun'),
    					array('60 Mo / 1 Base de données / 5 comptes mail / Trafic 20 Go mensuels','300 Mo / 2 Bases de données / 8 comptes mail / Trafic 30 Go mensuels','720 Mo / 25 Bases de données / 1000 comptes mail / Trafic 120 Go mensuels','Offre supérieure','Aucun'),
    					array('1 script','2 scripts','3 scripts','Plus de scripts dynamiques','Aucun'),
    					array('Oui','Non'));
     
    $titres = array('Nombre de pages statiques avec vos textes et photos ( FAQ )',
    					'Page de contact avec formulaire ( FAQ )',
    					'Nom de domaine pour 1 an ( FAQ )',
    					'Hébergement du site pour 1 an ( FAQ )',
    					'Nombre de scripts permettant la gestion dynamique d\'articles ( FAQ )',
    					'Script d\'upload d\'images sur votre serveur ( FAQ )');
     
    $tot = array(array(39,69,179,379,-1),
    			array(49,0),
    			array(19,24,34,0),
    			array(29,79,266,-1,0),
    			array(56,109,159,-1,0),
    			array(29,0));
     
    $goods = array(0,0,0,0,0,0);
    // Test si le formulaire a été validé afin d'être recalculé 
    if (isset($_GET["docalc"])) { 
    // Choix 1 - Nombre d epages statiques 
     
     
    for($i=0;$i<count($choix);$i++){
    	$goods[$i] = $_POST["choix".$i];
    	if($tot[$i][$goods[$i]] != -1)
    		$total  += $tot[$i][$goods[$i]];
    	else
    		$avert = true;
    }
     
     
    // Mise en ligne, configuration : + 20% 
    $total = $total + (($total * 20) / 100) ; 
    } 
    else if (!isset($_POST["calcul"])) 
    $total = "163.2" ; 
     
    if (!$avert) { 
    echo '<table><tr><td><img src="icon_euro.gif" width="20" height="20" alt="Total" /></td><td class="padding_cell"><span class="texte_bleu_gras">Total : '.$total.' EUR</span> &nbsp; Votre commande peut être validée par W2D Custom.</td></tr></table> 
    <p><br />' ; 
    } 
    // Affichage d'un avertissement vers Classic 
    else if ($avert) { 
    echo '<table><tr><td><img src="icon_avert.gif" width="20" height="20" alt="Total" /></td><td class="padding_cell"><span class="texte_bleu_gras">Avertissement</span> &nbsp; Votre formulaire comporte une ou plusieurs demandes ne pouvant être commandées via W2D Custom. Veuillez consulter les offres Sur mesure de <a href="">W2D Classic</a>.</td></tr></table> 
    <p><br />' ; 
    } 
     
    	for($i=0;$i<count($choix);$i++){
    		echo $titres[$i]."<br />";
    		for($j=0;$j<count($choix[$i]);$j++){
    			$checked = $goods[$i] == $j ? "checked='checked'" : "";
    			echo "<input type='radio' name='choix".$i."' value='".$j."' ".$checked." />".$choix[$i][$j]."<br />";
    		}
    	}
     
    ?>
     
    <!-- Inclus --> 
    Services inclus gratuitement<br /> 
    <input type="radio" name="inclus" value="1" checked="checked" /> Statistiques détaillées<br /><br /> 
    <!-- Calculer le formulaire --> 
    <br /> 
    <input type="image" name="calcul" alt="Calculer" src="bouton_calcul.gif" value="ok" /> 
    </p> 
    </form>

  19. #39
    Membre à l'essai
    Profil pro
    Inscrit en
    Novembre 2005
    Messages
    39
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2005
    Messages : 39
    Points : 15
    Points
    15
    Par défaut
    Haaaaaaa ok le image ne transmet pas sa valeur... je pensais que c'était bon car ça fonctionnait sur Firefox, merci du tuyau !!!

    Je met en résolu !

  20. #40
    Expert éminent Avatar de Mr N.
    Profil pro
    Inscrit en
    Septembre 2004
    Messages
    5 418
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2004
    Messages : 5 418
    Points : 6 449
    Points
    6 449
    Par défaut
    Bon ben, je me suis fais largement grilled, je mets juste mon code pour pas me dire que je l'ai fait pour rien
    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
    <?php
    //initialisations
    $quest = array(
       'Q1' => array(
          'question' => 'Rouge ou blanc ?',
          'reponses' => array(
             'R1' => array(
                'reponse' => 'rouge',
                'default' => true
             ),
             'R2' => array(
                'reponse' => 'blanc',
                'default' => false
             )
          )
       )
    );
     
    //Traitement requete
    if (isset($_REQUEST['reponses']) && is_array($_REQUEST['reponses'])) {
        foreach($_REQUEST['reponses'] as $question => $reponse) {
            if (isset($quest[$question])) {
                foreach($quest[$question]['reponses'] as $R_key => $rep) {
                    $quest[$question]['reponses'][$R_key]['default'] = false;
                }
                if (isset($quest[$question]['reponses'][$reponse])) {
                    $quest[$question]['reponses'][$reponse]['default'] = true;
                }
            }
        }
    }
     
    //Construction formulaire
    $output = '<form action="" method="post">';
    foreach($quest as $Q_key => $question) {
       $output .= '<h2>'.$question['question'].'</h2>';
       foreach($question['reponses'] as $R_key => $reponse) {
          $output .= '<input type="radio" name="reponses['.$Q_key.']" value="'.$R_key.'" '.($reponse['default']?'checked="checked"':'').'/>'.$reponse['reponse'].'<br />';
       }
    }
    $output .= '<input type="submit" value="send" /></form>';
    echo $output;
     
     
    ?>

+ Répondre à la discussion
Cette discussion est résolue.
Page 2 sur 3 PremièrePremière 123 DernièreDernière

Discussions similaires

  1. [PHP 5.0] Impossibilité de lancer un script PHP sur Ubuntu firefox
    Par SpeedOverflow dans le forum Langage
    Réponses: 5
    Dernier message: 17/01/2012, 16h37
  2. problème script php
    Par m.m.67 dans le forum PHP & Base de données
    Réponses: 1
    Dernier message: 17/07/2011, 21h16
  3. [MySQL] Problème script PHP
    Par sasuke41 dans le forum PHP & Base de données
    Réponses: 9
    Dernier message: 04/05/2009, 16h46
  4. [AJAX] [Xajax] script php xajax pour rafraichire
    Par micka30 dans le forum Général JavaScript
    Réponses: 0
    Dernier message: 19/04/2008, 15h21
  5. Problème script php
    Par kev07 dans le forum Langage
    Réponses: 1
    Dernier message: 20/10/2007, 20h52

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