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. #1
    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 Problème : Script PHP IE NOK Firefox OK
    Bonjour à tous,

    J'ai un petit problème avec un formulaire géré avec PHP : il s'agit d'un formulaire dans lequel vous choisissez des options dans des boutons radios, puis à la validation, le prix total est mis à jour, et les cases cochées précedemment sont checked.

    Le tout fonctionne nickel de chez parfaitement au point sur Firefox, et voilà que sur IE, à la validation du formulaire pour calcul, le total n'est pas mis à jour, et les radios ne sont pas checked... !

    Le code PHP prend les variables POST, puis en fonction, met à jour un total initialié à 0. Il y a ensuite un echo dans les <input... afin de mettre checked="checked" pour le radio qui avait été sélectionné précédement, les autres font un echo d'une chaine vide.

    Je précise que le tout est en XHTML 1.1 validé.

    Je ne comprend pas, car PHP s'execute côté serveur, pourquoi une différence entre Firefox et IE ?

    Si quelqu'un a une idée...

    Merci !

  2. #2
    Rédactrice
    Avatar de xave
    Femme Profil pro
    Développeur Web
    Inscrit en
    Mai 2002
    Messages
    871
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 46
    Localisation : France, Meurthe et Moselle (Lorraine)

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Mai 2002
    Messages : 871
    Points : 1 094
    Points
    1 094
    Par défaut
    Peut être un problème de rafraichissement sous IE... :

  3. #3
    Membre actif Avatar de hunter
    Profil pro
    Inscrit en
    Mars 2004
    Messages
    208
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Mars 2004
    Messages : 208
    Points : 216
    Points
    216
    Par défaut
    checked pas checked="checked" si ma mémoire est bonne
    ça peut être l'historique mais je verrais pas pourquoi
    et est-ce que ta page passe bien par le php sous ie (par ex fais un echo "salut" puis exit au milieu du code) ??

  4. #4
    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
    si si checked="checked" est je trouve plus correct que simplement checked. Surement l'habitude de mettre une valeur (meme vide) à des attributs

    Sinon il faudrait voir un peux de [code] de Saiyan, 1. le formulaire 2. le traitement...

  5. #5
    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 checked="checked" est plus correct que checked.

    Le PHP fonctionne car des echos s'affichent !

    De toute manère, je ne pense pas que ça vienne du PHP vu que sous Firefox, pas de problème... je sèche là :s

    Voilà le traitement :

    <?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"' ;
    $total = $total + 39 ;
    }
    else if ($choix1 == 2) {
    $choix1_2 = 'checked="checked"' ;
    $total = $total + 69 ;
    }
    else if ($choix1 == 3) {
    $choix1_3 = 'checked="checked"' ;
    $total = $total + 179 ;
    }
    else if ($choix1 == 4) {
    $choix1_4 = 'checked="checked"' ;
    $total = $total + 379 ;
    }
    else if ($choix1 == 5) {
    $choix1_5 = 'checked="checked"' ;
    $avert = true ;
    }
    // Choix 2 - Page de contact
    $choix2 = $_POST["choix2"] ;
    if ($choix2 == 1) {
    $choix2_1 = 'checked="checked"' ;
    $total = $total + 49 ;
    }
    else if ($choix2 == 2) {
    $choix2_2 = 'checked="checked"' ;
    }
    // Choix 3 - Domaine
    $choix3 = $_POST["choix3"] ;
    if ($choix3 == 1) {
    $choix3_1 = 'checked="checked"' ;
    $total = $total + 19 ;
    }
    else if ($choix3 == 2) {
    $choix3_2 = 'checked="checked"' ;
    $total = $total + 24 ;
    }
    else if ($choix3 == 3) {
    $choix3_3 = 'checked="checked"' ;
    $total = $total + 34 ;

    }
    else if ($choix3 == 4) {
    $choix3_4 = 'checked="checked"' ;
    }
    // Choix 4 - Hébergement
    $choix4 = $_POST["choix4"] ;
    if ($choix4 == 1) {
    $choix4_1 = 'checked="checked"' ;
    $total = $total + 29 ;
    }
    else if ($choix4 == 2) {
    $choix4_2 = 'checked="checked"' ;
    $total = $total + 79 ;
    }
    else if ($choix4 == 3) {
    $choix4_3 = 'checked="checked"' ;
    $total = $total + 266 ;
    }
    else if ($choix4 == 4) {
    $choix4_4 = 'checked="checked"' ;
    $avert = true ;
    }
    else if ($choix4 == 5) {
    $choix4_5 = 'checked="checked"' ;
    }
    // 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"' ;
    }
    // +20%
    $total = $total + (($total * 20) / 100) ;
    }
    else if (!isset($_POST["calcul"]))
    $total = 163.2 ;
    ?>
    Et le formulaire :

    <form id="custom1.0" action="<?php echo $_SERVER['PHP_SELF'] ; ?>" 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
    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 />' ;
    }
    ?>
    <!-- Choix 1 - Nombre de pages statiques -->
    Nombre de pages statiques avec vos textes et photos ( FAQ )<br />
    <input type="radio" name="choix1" value="1" <?php echo $choix1_1 ; ?> /> 1 page<br />
    <input type="radio" name="choix1" value="2" <?php echo $choix1_2 ; ?> /> 2 pages<br />
    <input type="radio" name="choix1" value="3" <?php echo $choix1_3 ; ?> /> 3 à 5 pages<br />
    <input type="radio" name="choix1" value="4" <?php echo $choix1_4 ; ?> /> 5 à 10 pages<br />
    <input type="radio" name="choix1" value="5" <?php echo $choix1_5 ; ?> /> Plus<br /><br />
    <!-- Choix 2 - Page de contact -->
    Page de contact avec formulaire ( FAQ )<br />
    <input type="radio" name="choix2" value="1" <?php echo $choix2_1 ; ?> /> Oui<br />
    <input type="radio" name="choix2" value="2" <?php echo $choix2_2 ; ?> /> Non<br /><br />
    <!-- Choix 3 - Nom de domaine -->
    Nom de domaine pour 1 an ( FAQ )<br />
    <input type="radio" name="choix3" value="1" <?php echo $choix3_1 ; ?> /> Domaine .com .net .org .info ou .biz<br />
    <input type="radio" name="choix3" value="2" <?php echo $choix3_2 ; ?> /> Domaine .eu<br />
    <input type="radio" name="choix3" value="3" <?php echo $choix3_3 ; ?> /> Domaine .fr<br />
    <input type="radio" name="choix3" value="4" <?php echo $choix3_4 ; ?> /> Aucun<br /><br />
    <!-- Choix 4 - Hébergement -->
    Hébergement du site pour 1 an ( FAQ )<br />
    <input type="radio" name="choix4" value="1" <?php echo $choix4_1 ; ?> /> 60 Mo / 1 Base de données / 5 comptes mail / Trafic 20 Go mensuels<br />
    <input type="radio" name="choix4" value="2" <?php echo $choix4_2 ; ?> /> 300 Mo / 2 Bases de données / 8 comptes mail / Trafic 30 Go mensuels<br />
    <input type="radio" name="choix4" value="3" <?php echo $choix4_3 ; ?> /> 720 Mo / 25 Bases de données / 1000 comptes mail / Trafic 120 Go mensuels<br />
    <input type="radio" name="choix4" value="4" <?php echo $choix4_4 ; ?> /> Offre supérieure<br />
    <input type="radio" name="choix4" value="5" <?php echo $choix4_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" <?php echo $choix5_1 ; ?> /> 1 script<br />
    <input type="radio" name="choix5" value="2" <?php echo $choix5_2 ; ?> /> 2 scripts<br />
    <input type="radio" name="choix5" value="3" <?php echo $choix5_3 ; ?> /> 3 scripts<br />
    <input type="radio" name="choix5" value="4" <?php echo $choix5_4 ; ?> /> Plus de scripts dynamiques<br />
    <input type="radio" name="choix5" value="5" <?php echo $choix5_5 ; ?> /> 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" <?php echo $choix6_1 ; ?> /> Oui<br />
    <input type="radio" name="choix6" value="2" <?php echo $choix6_2 ; ?> /> 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>

  6. #6
    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
    Regarde le code source du formulaire généré tu comprendras certainement ton erreur

  7. #7
    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
    Je ne peut malheureusement pas uploader pour essayer car je suis en cours à la fac... hum ^^

    Ce que je vois c'est que je n'ai pas mis l'attribut name dans form... mouais, et que j'ai deux input de type image... hum je ne pense pas que ce soit ça, si ?

  8. #8
    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
    Oulah ! Ca sera dit, répété et amplifié que tu vas sur les forums en cours !!!

    Sinon j'aime bien garder les surprises alors je te laisse regarder ça se soir quand tu pourras uploader. Si je te dis tout tout de suite c'est pas marrant, tu vas pas apprendre

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

    Informations forums :
    Inscription : Novembre 2005
    Messages : 3 868
    Points : 5 011
    Points
    5 011
    Par défaut
    checked => html 4, xhtml transitionnel
    checked='checked' => xhtml strict
    Alunissage : Procédé technique consistant à déposer des imbéciles sur un rêve enfantin.

    Cours | FAQ | Sources Javascript
    Cours | FAQ | Sources PHP
    Mes Articles

  10. #10
    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
    Merci pour la confirmation siddh
    Donc je traduis :
    checked => pour les vieux
    checked='checked' => pour les d'jeuns

  11. #11
    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.
    Oulah ! Ca sera dit, répété et amplifié que tu vas sur les forums en cours !!!

    Sinon j'aime bien garder les surprises alors je te laisse regarder ça se soir quand tu pourras uploader. Si je te dis tout tout de suite c'est pas marrant, tu vas pas apprendre
    Haaaaaaaaaaaaaaaa pitié

  12. #12
    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'aime faire souffrir

  13. #13
    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'aime faire souffrir
    Tu serais pas un peu lourd des fois ? Hum...

  14. #14
    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

    Hum... souvent je dirais ! Désolé mais je ne te donnerais pas la solution sur un plateau d'argent. Et ce n'est pas la peine d'insister :o mais rassures-toi, un autre que moi te vendra surement la mêche...

    Pour te donner une piste, le code html produit par php est faux. Sur ce bon cours

    Au fait pourquoi ne pourrais-tu pas uploader depuis la fac ? tu as des clients ftp meme sous dos

  15. #15
    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 je n'ai pas mes mots de passe sur moi ^^ Et j'ai oublié ma clé...

  16. #16
    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
    Hum... j'ai vu un truc bizarre, je sais pas si c'est ça... j'essayerai

    EDIT

    J'ai rien dit

  17. #17
    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
    Je ne comprend pas, si le code est faux, pourquoi Firefox l'interprête correctement ? D'habitude c'est l'inerse... :s

  18. #18
    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
    Oui ça c'est un mystère...
    que seul les dev de Fx peuvent expliquer

  19. #19
    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.
    Oui ça c'est un mystère...
    que seul les dev de Fx peuvent expliquer
    lol ok je suis pas le seul alors

    Bon, je vais retourner ce code une énième fois...

  20. #20
    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
    Poste nous le code source html généré par ton script pour voir (bien sur après la soumission, quand l'affichage est faux)

+ Répondre à la discussion
Cette discussion est résolue.
Page 1 sur 3 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