Aller au contenu

MS-DOS_1991

Hubmaster
  • Compteur de contenus

    442
  • Inscrit(e) le

  • Dernière visite

Messages postés par MS-DOS_1991

  1. euh... lol tu es sûr d'avoir uploadé tes fichiers ? :lol:

    En fait, ce qui serait parfait, ce serait d'avoir avant même de renseigner les champs, les sous-totaux et le total général fixé à 0.

    Je l'ai corrigé (démo sur ma page de test: /bp16/form.html)

    form.html

    <?xml version="1.0"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Achat de Cartons de Vin</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <script type="text/javascript">
    // <!-- <[CDATA[
    function calculerPrix(champs, span) {
    var prix;
    prix = champs * 4.50;
    prix = prix + '€';
    document.getElementById(span).innerHTML = prix;
    }
    function calculerTotal(form, span) {
    var cartons_vin1;
    var cartons_vin2;
    var cartons_vin3;
    var total;
    cartons_vin1 = form.cartons_vin1.value * 4.5;
    cartons_vin2 = form.cartons_vin2.value * 4.5 ;
    cartons_vin3 = form.cartons_vin3.value * 4.5;
    total = Number(cartons_vin1) + Number(cartons_vin2) + Number(cartons_vin3);
    document.getElementById(span).innerHTML = '= ' + total + '€';
    }
    // ]]> -->
    </script>
    </head>
    <body>
    <div id="contenu_principal">
    <form method="post" action="traitement.php" id="cartons_vins">
    <p><label for="Nom">Votre Nom : <input type="text" name="Nom" id="Nom" value="" /></label></p>
    <p><label for="Prenom">Votre Prénom : <input type="text" name="Prenom" id="Prenom" value="" /></label></p>
    <p><label for="Email">Votre email : <input type="text" name="Email" id="Email" value="" /></label></p>
    <p><label for="Adresse">Votre adresse : <textarea name="Adresse" id="Adresse"></textarea></label></p>
    <p><u>Vin 1</u></p>
    <p><label for="cartons_vin1">Nombre de carton(s) souhaité(s) : 
    <input type="text" name="cartons_vin1" id="cartons_vin1" size="2" maxlength="2" onBlur="calculerPrix(this.value, 'affichage_prix-vin1')" value="0" /></label> x 4,50€ <span id="affichage_prix-vin1"> = 0.00€</span></p>
    <p><u>Vin 2</u></p>
    <p><label for="cartons_vin2">Nombre de carton(s) souhaité(s) : 
    <input type="text" name="cartons_vin2" id="cartons_vin2" size="2" maxlength="2" onBlur="calculerPrix(this.value, 'affichage_prix-vin2')" value="0" /></label> x 4,50€ <span id="affichage_prix-vin2"> = 0.00€</span></p>
    <p><u>Vin 3</u></p>
    <p><label for="cartons_vin3">Nombre de carton(s) souhaité(s) : 
    <input type="text" name="cartons_vin3" id="cartons_vin3" size="2" maxlength="2" onBlur="calculerPrix(this.value, 'affichage_prix-vin3');calculerTotal(this.form, 'affichage_total-vins')" value="0" /></label> x 4,50€ <span id="affichage_prix-vin3"> = 0.00€</span></p>
    <p><strong>Total : </strong>
    <span id="affichage_total-vins"> </span></p>
    <p><input type="submit" value="Envoyer" /><input type="reset" value="Annuler" /></p>
    </form>
    </div>
    </body>
    </html>

    traitement.php

    <?php
    // Formulaire envoye ? Champs Vides ?
    foreach($_POST as $champs => $valeur) {
    if($champs != 'cartons_vin1' AND $champs != 'cartons_vin2' AND $champs != 'cartons_vin3') {
     if(!isset($valeur) OR empty($valeur)) {
      echo '<script type="text/javascript">// <![CDATA[',"\n",'alert("Veuillez remplir tous les champs.");',"\n",'window.location="form.html";',"\n",'// ]]>',"\n",'</script>';
     }
    }
    }
    // Declaration des variables
    $Nom = trim(strip_tags($_POST['Nom']));
    $Prenom = trim(strip_tags($_POST['Prenom']));
    $Email = trim(strip_tags($_POST['Email']));
    $Adresse = trim(strip_tags($_POST['Adresse']));
    $NbreCartons['vin1'] = trim(strip_tags($_POST['cartons_vin1']));
    $NbreCartons['vin2'] = trim(strip_tags($_POST['cartons_vin2']));
    $NbreCartons['vin3'] = trim(strip_tags($_POST['cartons_vin3']));
    $SousTotal['vin1'] = $NbreCartons['vin1'] * 4.5;
    $SousTotal['vin2'] = $NbreCartons['vin2'] * 4.5;
    $SousTotal['vin3'] = $NbreCartons['vin3'] * 4.5;
    $Total = $SousTotal['vin1'] + $SousTotal['vin2'] + $SousTotal['vin3'];
    ?>
    <?php echo '<','?xml version="1.0" encoding="ISO-8859-1" ?','>',"\n"; ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr-FR" dir="ltr">
    <head xml:lang="fr-FR" dir="ltr">
     <title>
      Achat de Cartons de Vin - Récapitulatif de votre Commande
     </title>
     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    </head>
    <body>
     <div id="contenu_principal">
      <h3>Récapitulatif de vos Informations :</h3>
      <p>Votre Nom : <strong><?php echo $Nom; ?></strong></p>
      <p>Votre Prénom : <strong><?php echo $Prenom; ?></strong></p>
      <p>Votre Adresse Email : <strong><?php echo $Email; ?></strong></p>
      <p>Votre Adresse Postale : <strong><?php echo $Adresse; ?></strong></p>
      <h3>Récapitulatif de votre Commande</h3>
      <p>Vous avez commandé <?php echo ($NbreCartons['vin1'] == 1) ? "<strong>{$NbreCartons['vin1']}</strong> carton " : "{$NbreCartons['vin1']} cartons "; ?>du vin n°1, soit un total de <strong><?php echo $SousTotal['vin1']; ?></strong> €.</p>
      <p>Vous avez commandé <?php echo ($NbreCartons['vin1'] == 1) ? "<strong>{$NbreCartons['vin2']}</strong> carton " : "{$NbreCartons['vin2']} cartons "; ?>du vin n°2, soit un total de <strong><?php echo $SousTotal['vin2']; ?></strong> €.</p>
      <p>Vous avez commandé <?php echo ($NbreCartons['vin1'] == 1) ? "<strong>{$NbreCartons['vin3']}</strong> carton " : "{$NbreCartons['vin3']} cartons "; ?>du vin n°3, soit un total de <strong><?php echo $SousTotal['vin3']; ?></strong> €.</p>
      <p style="font-weight: bold; color: #c00000;">Le total de votre commande s'élève donc à <strong><?php echo $Total; ?></strong> €.</p>
      <p><a href="form.html">Modifier vos Informations</a> | <a href="javascript:print()">Imprimer cette Page</a>
     </div>
    </body>
    </html>

  2. Honte sur moi !!

    J'ai oublié le ; de la ligne 5, dans traitement.php !! :unsure::unsure:

    snif... snif.. :lol::lol:

    par souci d'esthétique, j'ai amélioré un peu mon code:

    <?php
    // Formulaire envoye ? Champs Vides ?
    foreach($_POST as $champs => $valeur) {
    if(!isset($valeur) OR empty($valeur)) {
     echo '<script type="text/javascript">// <![CDATA[',"\n",'alert("Veuillez remplir tous les champs.");',"\n",'window.location="http://bricepap.free.fr/couronneau/form.htm";',"\n",'// ]]>',"\n",'</script>';
    }
    }
    // Declaration des variables
    $Nom = trim(strip_tags($_POST['Nom']));
    $Prenom = trim(strip_tags($_POST['Prenom']));
    $Email = trim(strip_tags($_POST['Email']));
    $Adresse = trim(strip_tags($_POST['Adresse']));
    $NbreCartons['vin1'] = trim(strip_tags($_POST['cartons_vin1']));
    $NbreCartons['vin2'] = trim(strip_tags($_POST['cartons_vin2']));
    $NbreCartons['vin3'] = trim(strip_tags($_POST['cartons_vin3']));
    $SousTotal['vin1'] = $NbreCartons['vin1'] * 4.5;
    $SousTotal['vin2'] = $NbreCartons['vin2'] * 4.5;
    $SousTotal['vin3'] = $NbreCartons['vin3'] * 4.5;
    $Total = $SousTotal['vin1'] + $SousTotal['vin2'] + $SousTotal['vin3'];
    ?>
    <?php echo '<','?xml version="1.0" encoding="ISO-8859-1" ?','>',"\n"; ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr-FR" dir="ltr">
    <head xml:lang="fr-FR" dir="ltr">
     <title>
      Achat de Cartons de Vin - Récapitulatif de votre Commande
     </title>
     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    </head>
    <body>
     <div id="contenu_principal">
      <h3>Récapitulatif de vos Informations :</h3>
      <p>Votre Nom : <strong><?php echo $Nom; ?></strong></p>
      <p>Votre Prénom : <strong><?php echo $Prenom; ?></strong></p>
      <p>Votre Adresse Email : <strong><?php echo $Email; ?></strong></p>
      <p>Votre Adresse Postale : <strong><?php echo $Adresse; ?></strong></p>
      <h3>Récapitulatif de votre Commande</h3>
      <p>Vous avez commandé <?php echo ($NbreCartons['vin1'] == 1) ? "<strong>{$NbreCartons['vin1']}</strong> carton " : "{$NbreCartons['vin1']} cartons "; ?>du vin n°1, soit un total de <strong><?php echo $SousTotal['vin1']; ?></strong> €.</p>
      <p>Vous avez commandé <?php echo ($NbreCartons['vin1'] == 1) ? "<strong>{$NbreCartons['vin2']}</strong> carton " : "{$NbreCartons['vin2']} cartons "; ?>du vin n°2, soit un total de <strong><?php echo $SousTotal['vin2']; ?></strong> €.</p>
      <p>Vous avez commandé <?php echo ($NbreCartons['vin1'] == 1) ? "<strong>{$NbreCartons['vin3']}</strong> carton " : "{$NbreCartons['vin3']} cartons "; ?>du vin n°3, soit un total de <strong><?php echo $SousTotal['vin3']; ?></strong> €.</p>
      <p style="font-weight: bold; color: #c00000;">Le total de votre commande s'élève donc à <strong><?php echo $Total; ?></strong> €.</p>
      <p><a href="form.html">Modifier vos Informations</a> | <a href="javascript:print()">Imprimer cette Page</a>
     </div>
    </body>
    </html>

    => Le mot carton(s) est au singulier si 1 seul carton est commandé (logique)

  3. ReBonjour :)

    1. Traitement.php

    Cette page récupère les données de façon dynamique de sorte que l'utilisateur n'ai plus qu'à imprimer n'est-pas ? Quel est le code à intégrer dans cette page ? Peut-on avoir sur cette page de récapitulatif de commande un message d'entête tout fait du style :

    "Voici le récapitulatif de votre commande. Vous pouvez maintenant l'imprimer et l'envoyer à l'adresse suivante : Blablabla"

    Voici le code ;) :

    <?php
    // Formulaire envoye ? Champs Vides ?
    foreach($_POST as $champs => $valeur) {
    if(!isset($valeur) OR empty($valeur)) {
     echo '<script type="text/javascript">// <![CDATA[',"\n",'alert("Veuillez remplir tous les champs.");',"\n",'window.location="http://bricepap.free.fr/couronneau/form.htm";',"\n",'// ]]>',"\n",'</script>'
     exit;
    }
    }
    // Declaration des variables
    $Nom = trim(strip_tags($_POST['Nom']));
    $Prenom = trim(strip_tags($_POST['Prenom']));
    $Email = trim(strip_tags($_POST['Email']));
    $Adresse = trim(strip_tags($_POST['Adresse']));
    $NbreCartons['vin1'] = trim(strip_tags($_POST['cartons_vin1']));
    $NbreCartons['vin2'] = trim(strip_tags($_POST['cartons_vin2']));
    $NbreCartons['vin3'] = trim(strip_tags($_POST['cartons_vin3']));
    $SousTotal['vin1'] = $NbreCartons['vin1'] * 4.5;
    $SousTotal['vin2'] = $NbreCartons['vin2'] * 4.5;
    $SousTotal['vin3'] = $NbreCartons['vin3'] * 4.5;
    $Total = $SousTotal['vin1'] + $SousTotal['vin2'] + $SousTotal['vin3'];
    ?>
    <?php echo '<','?xml version="1.0" encoding="ISO-8859-1" ?','>',"\n"; ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr-FR" dir="ltr">
    <head xml:lang="fr-FR" dir="ltr">
     <title>
      Achat de Cartons de Vin - Récapitulatif de votre Commande
     </title>
     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    </head>
    <body>
     <div id="contenu_principal">
      <h3>Récapitulatif de vos Informations :</h3>
      <p>Votre Nom : <strong><?php echo $Nom; ?></strong></p>
      <p>Votre Prénom : <strong><?php echo $Prenom; ?></strong></p>
      <p>Votre Adresse Email : <strong><?php echo $Email; ?></strong></p>
      <p>Votre Adresse Postale : <strong><?php echo $Adresse; ?></strong></p>
      <h3>Récapitulatif de votre Commande</h3>
      <p>Vous avez commandé <strong><?php echo $NbreCartons['vin1']; ?></strong> cartons du vin n°1, soit un total de <strong><?php echo $SousTotal['vin1']; ?></strong> €.</p>
      <p>Vous avez commandé <strong><?php echo $NbreCartons['vin1']; ?></strong> cartons du vin n°2, soit un total de <strong><?php echo $SousTotal['vin1']; ?></strong> €.</p>
      <p>Vous avez commandé <strong><?php echo $NbreCartons['vin1']; ?></strong> cartons du vin n°3, soit un total de <strong><?php echo $SousTotal['vin1']; ?></strong> €.</p>
      <p style="font-weight: bold; color: #c00000;">Le total de votre commande s'élève donc à <strong><?php echo $Total; ?></strong> €.</p>
      <p><a href="http://bricepap.free.fr/couronneau/form.htm">Modifier vos Informations</a> | <a href="javascript:print()">Imprimer cette Page</a>
     </div>
    </body>
    </html>

    2. La valeur zéro par défault

    Est-ce possible d'avoir par défault la valeur zéro dans les champs de la page de commande, sinon, le calcul final ne se fait pas...

    C'est très possible: il suffit de rajouter à la fin de chaque balise <input /> l'attribut value:

    <input type="text" name="champs" id="champs" maxlength="2" value="0" />

    Merci infiniment pour ton aide, tu me donneras ton adresse et je te ferai parvenir une bonne bouteille biggrin.gif (sans blague en plus !!)

    :lol: Je n'y manquerai pas :yoot:

  4. Salut :)

    Je ne suis pas un expert en javaScript (loin de là :hypocrite: ). Ce code a cependant l'avantage de marcher (avantage indéniable n'est-ce pas? :lol: ) et d'être facilement adaptable (il suffit de changer les variables dans l'appel des fonctions:

    <?xml version="1.0"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Achat de Cartons de Vin</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <script type="text/javascript">
    // <!-- <[CDATA[
    function calculerPrix(champs, span) {
    var prix;
    prix = champs * 4.50;
    prix = prix + '€';
    document.getElementById(span).innerHTML = prix;
    }
    function calculerTotal(form, span) {
    var cartons_vin1;
    var cartons_vin2;
    var cartons_vin3;
    var total;
    cartons_vin1 = form.cartons_vin1.value * 4.5;
    cartons_vin2 = form.cartons_vin2.value * 4.5 ;
    cartons_vin3 = form.cartons_vin3.value * 4.5;
    total = Number(cartons_vin1) + Number(cartons_vin2) + Number(cartons_vin3);
    total = total + '€';
    document.getElementById(span).innerHTML = total;
    }
    // ]]> -->
    </script>
    </head>
    <body>
    <div id="contenu_principal">
    <form method="post" action="traitement.php" id="cartons_vins">
    <p><label for="Nom">Votre Nom : <input type="text" name="Nom" id="Nom" value="" /></label></p>
    <p><label for="Prenom">Votre Prénom : <input type="text" name="Prenom" id="Prenom" value="" /></label></p>
    <p><label for="Email">Votre email : <input type="text" name="Email" id="Email" value="" /></label></p>
    <p><label for="Adresse">Votre adresse : <textarea name="Adresse" id="Adresse"></textarea></label></p>
    <p><u>Vin 1</u></p>
    <p><label for="cartons_vin1">Nombre de carton(s) souhaité(s) : 
    <input type="text" name="cartons_vin1" id="cartons_vin1" size="2" maxlength="2" onBlur="calculerPrix(this.value, 'affichage_prix-vin1')" /></label> x 4,50€ = 
    <span id="affichage_prix-vin1"> </span></p>
    <p><u>Vin 2</u></p>
    <p><label for="cartons_vin2">Nombre de carton(s) souhaité(s) : 
    <input type="text" name="cartons_vin2" id="cartons_vin2" size="2" maxlength="2" onBlur="calculerPrix(this.value, 'affichage_prix-vin2')" /></label> x 4,50€ = 
    <span id="affichage_prix-vin2"> </span></p>
    <p><u>Vin 3</u></p>
    <p><label for="cartons_vin3">Nombre de carton(s) souhaité(s) : 
    <input name="cartons_vin3" id="cartons_vin3" type="text" size="2" maxlength="2" onBlur="calculerPrix(this.value, 'affichage_prix-vin3');calculerTotal(this.form, 'affichage_total-vins')" /></label> x 4,50€ = 
    <span id="affichage_prix-vin3"> </span></p>
    <p><strong>Total : </strong>
    <span id="affichage_total-vins"> </span></p>
    <p><input type="submit" value="Envoyer" /><input type="reset" value="Annuler" onClick="razPrix()" /></p>
    </form>
    </div>
    </body>
    </html>

    edit: Désolé si cela paraît un peu fouillit au premier abord :lol::lol:

  5. Bonjour :)

    Je trouve -opinion personnelle bien sûr :rolleyes: - que la partie gauche (menu) et haute (bannière et menu de navigation) sont trop proches et semblables en termes de couleur, ca fait un peu fouilli :hypocrite:

    De plus je pense que tu devrais mettre "Choix du style Futuriste - Classique" sur la même ligne que "Accueil Forum Annuaire Contact"

    A part ça, le design a l'air pas mal, reste à savoir si le contenu suivra lui-aussi :lol::lol:

    edit: il y a un bug avec FireFox sur la page des kits allopass (http://www.zone-webmasters.net/kits-graphiques-allopass.php)

  6. Salut :)

    Dans ton cas, cela se présenterait plutôt comme cela je pense (sans partie serveur pour plus de simplicité):

    <form action="mailto:tonadresseemail_AT_fournisseur.ext" method="post" enctype="text/plain">
    <!-- ICI TES CHAMPS DE FORMULAIRE -->
    <input type="submit" value="Envoyer le Formulaire" />
    </form>

    pas testé, je fais toujours ce genre de trucs en php :unsure::rolleyes:

  7. Salut :)

    Tu peux peut-être faire cela en une seule liste avec optgroup qui s'utilise comme cela (selon mes souvenirs :hypocrite:):

    <select name="listepays_regions">
    <optgroup label="france">
    <option name="region_1" value="region_1">Region 1</option>
    ...
    <option name="region_x" value="region_x">Region X</option>
    </optgroup>
    <optgroup label="suisse">
    <option name="region_1" value="region_1">Region 1</option>
    ...
    <option name="region_y" value="region_y">Region Y</option>
    </optgroup>
    <optgroup label="belgique">
    <option name="region_1" value="region_1">Region 1</option>
    ...
    <option name="region_z" value="region_z">Region Z</option>
    </optgroup>
    </select>

    ou alors avec du javascript (plus vraisemblablement dans ton cas) mais je ne saurais pas le coder "a l'arrache" :unsure:

    if, else

    <?php echo htmlEntities($reponse),'<a href="lien.php">Lien</a>'; ?>
    ...
    else echo "Et non, ce n'est pas l'image numéro ".$reponse,'<img src="tonimage.jpg" />';

    ... Je ne comprends pas bien ce que tu souhaites faire :unsure:

  8. Salut :)

    C'est possible avec l'attribut disabled: ;)

    <select name="monselect" disabled="disabled">
    <option name="option_1" value="option_1">OPTION 1</option>
    <option name="option_2" value="option_2">OPTION 2</option>
    <option name="option_3" value="option_3">OPTION 3</option>
    </select>

    ou

    <select name="monselect">
    <option name="option_1" value="option_1">OPTION 1</option>
    <option name="option_2" value="option_2" disabled="disabled">OPTION 2</option>
    <option name="option_3" value="option_3">OPTION 3</option>
    </select>

  9. Salut :)

    Je ne suis pas sûr de comprendre à quoi cela sert mais bon...

    Pourquoi pas en JavaScript ?

    <script type="text/javascript">
    // <[CDATA[
    function RefreshPrevious() {
    window.history.go(-1);
    window.refresh();
    }
    // ]]>
    </script>
    <a href="javascript:RefreshPrevious()">Rafraîchir Page Précédente</a>

    (pas testé :hypocrite: et je suis nul en javascript :lol: )

  10. Et c'était quoi ce carré au début de ton code wink.gif ??

    Bien vu ;)

    Il me semble aussi que la fonction setcookie() renvoie le même type d'information que header(). Par conséquent, l'usage de l'une interdit l'autre ^_^

    P.S: Dites-moi si je me trompe :unsure:

×
×
  • Créer...